UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#212248#3811. T1ZzhAllen50684ms1320kbC++111.2kb2024-10-13 15:56:132024-10-13 19:36:18

answer

//TOO MUCH HOMEWORK CAUSE THAT I WRITE A BAOLI 
#include <bits/stdc++.h>
#define F(i,x,y) for (int i = x; i <= y; i ++ )
#define D(i,x,y) for (int i = x; i >= y; i -- )
#define E(i,s) for (auto &i : s)
#define int long long
using namespace std;
constexpr int N = 2e5 + 10;
#define node pair<int,int> 
#define x first
#define y second
int t;

int get(node A, node B)
{
    return max(A.x + B.x, A.y + B.y);
}
vector<node> l, c;
map<node, bool> mpl,mpc;
int clac()
{
    int res = 1e18;
    E(t,l)
    if (mpl[t])
    E(v,c)
    if (mpc[v])
    res = min(res, get(t,v));
    return res == 1e18?-1:res;
}
void koishi()
{
    cin >> t;
    while (t -- )
    {
        int opt, d, a, b;
        cin >> opt >> d >> a >> b;
        if (opt)
        {
            if (d) l.push_back({a,b}), mpl[node{a,b}] = true;
            else c.push_back({a,b}), mpc[node{a,b}] = true;
        } else 
        {
            if (d) mpl[node{a,b}] = false;
            else mpc[node{a,b}] = false;
        }
        cout << clac() << '\n';
    }
}
#undef int
int main()
{
    ios::sync_with_stdio(NULL),cin.tie(nullptr),cout.tie(nullptr);
    koishi();
    return 0;
}

详细

小提示:点击横条可展开更详细的信息

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 0ms
memory: 1260kb

input:

100
1 0 30056910 791979446
0 0 30056910 791979446
1 1 87818006 915325879
1 0 885405412 638527154
0 1...

output:

-1
-1
-1
1553853033
-1
-1
-1
1372223954
1160777349
1160777349
787718936
787718936
1160777349
-1
-1
-...

result:

ok 100 numbers

Subtask #2:

score: 10
Accepted

Test #2:

score: 10
Accepted
time: 1ms
memory: 1256kb

input:

100
1 0 888145469 920169409
1 0 452904566 455699108
1 0 9314511 72429163
0 0 452904566 455699108
1 1...

output:

-1
-1
-1
-1
560615725
560615725
560615725
560615725
560615725
738065491
738065491
1439446683
8215374...

result:

ok 100 numbers

Subtask #3:

score: 10
Accepted

Test #3:

score: 10
Accepted
time: 210ms
memory: 1320kb

input:

1000
1 0 434052041 886975755
1 0 5735137 42531708
1 0 333067530 62734547
0 0 434052041 886975755
1 1...

output:

-1
-1
-1
-1
839243210
831398858
1022941456
1158731251
462065303
462065303
-1
-1
407960422
407960422
...

result:

ok 1000 numbers

Subtask #4:

score: 10
Accepted

Test #4:

score: 10
Accepted
time: 214ms
memory: 1320kb

input:

1000
1 1 99608765 102738517
1 0 409526489 651778959
1 1 632469167 447766999
1 1 596595729 295223176
...

output:

-1
754517476
754517476
754517476
754517476
754517476
240180556
240180556
240180556
240180556
7545174...

result:

ok 1000 numbers

Subtask #5:

score: 10
Accepted

Test #5:

score: 10
Accepted
time: 259ms
memory: 1316kb

input:

1000
1 1 392884476 341683390
1 1 812391583 884023296
0 1 392884476 341683390
0 1 812391583 884023296...

output:

-1
-1
-1
-1
-1
-1
-1
1033130556
-1
-1
596121801
596121801
572006216
572006216
572006216
572006216
57...

result:

ok 1000 numbers

Subtask #6:

score: 0
Time Limit Exceeded

Test #6:

score: 0
Time Limit Exceeded

input:

200000
1 0 745208991 893565181
1 1 338915529 332862800
1 1 879402360 343669571
0 0 745208991 8935651...

output:

-1
1226427981
1226427981
-1
1156522405
1156522405
907552725
851482156
851482156
851482156
851482156
...

result:


Subtask #7:

score: 0
Time Limit Exceeded

Test #7:

score: 0
Time Limit Exceeded

input:

200000
1 0 61288090 442363511
1 0 702180888 491607485
0 0 702180888 491607485
0 0 61288090 442363511...

output:

-1
-1
-1
-1
-1
1369535428
1182928863
1182928863
-1
568524713
568524713
568524713
568524713
548209901...

result:


Subtask #8:

score: 0
Time Limit Exceeded

Test #8:

score: 0
Time Limit Exceeded

input:

200000
1 0 965089945 885763418
1 0 47734550 558904612
0 0 47734550 558904612
1 0 511007140 115554736...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
770546713
770546713
1082209730
1082209730
1082209730
1082209730
108...

result:


Subtask #9:

score: 0
Time Limit Exceeded

Test #9:

score: 0
Time Limit Exceeded

input:

1000000
1 1 598963903 48224788
1 0 880787238 21153517
1 0 874812562 609964051
0 1 598963903 48224788...

output:

-1
1479751141
1473776465
-1
-1
1484975949
1433383436
1331359936
1074242658
865998205
865998205
86599...

result:


Subtask #10:

score: 0
Time Limit Exceeded

Test #10:

score: 0
Time Limit Exceeded

input:

1000000
1 0 532848699 733617288
1 1 59884418 599409867
0 1 59884418 599409867
1 0 1137393 496603003
...

output:

-1
1333027155
-1
-1
1118403184
1355417469
1355417469
1140899234
1085347521
1078478006
1085347521
672...

result: