UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#212238#3811. T1Matthew054ms1216kbC++1.4kb2024-10-13 15:46:372024-10-13 19:35:53

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5;
int n, opt, d, x, y, lx[N], ly[N], cx[N], cy[N],l,c;
int calc(){
    int ans = INT_MAX;
    if(!(l&&c))return -1;
    for(int i = 1;i <= l;i++){
        for(int j = 1;j <= c;j++){
            int D = max(lx[i]+cx[j],ly[i]+cy[j]);
            ans = min(ans,D);
        }
    }
    return ans;
}
int main()
{
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> opt >> d >> x >> y;
        if (opt == 1)
        {
            if (d == 1)
            {
                l++;
                lx[l] = x;
                ly[l] = y;
            }
            else
            {
                c++;
                cx[c] = x;
                cy[c] = y;
            }
        }
        else {
            if(d==1){
                for(int j = 1;j<=l;j++){
                    if(lx[j]==x&&ly[j]==y){
                        l--,lx[j]=INT_MAX,ly[j]=INT_MAX;
                        break;
                    }
                }
            }
            else {
                
                for(int j = 1;j<=c;j++){
                    if(cx[j]==x&&cy[j]==y){
                        c--,cx[j]=INT_MAX,cy[j]=INT_MAX;
                        break;
                    }
                }
            }
        }
        cout << calc() << endl;
    }
    return 0;
}

详细

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

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 1212kb

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
-1473269110
-1473269110
-1473269110
-1846327523
-1846327523
-1473269110...

result:

wrong answer 8th numbers differ - expected: '1372223954', found: '-1473269110'

Subtask #2:

score: 0
Wrong Answer

Test #2:

score: 0
Wrong Answer
time: 0ms
memory: 1212kb

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
-1596182435
-1596182435
-1596182435
-1596182435
-1596182435
-1596182435
-1596182435
-159...

result:

wrong answer 5th numbers differ - expected: '560615725', found: '-1596182435'

Subtask #3:

score: 0
Wrong Answer

Test #3:

score: 0
Wrong Answer
time: 23ms
memory: 1216kb

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
-1350772147
-1350772147
-1350772147
-2
-1969889836
-1969889836
-1969889836
-1969889836
-...

result:

wrong answer 5th numbers differ - expected: '839243210', found: '-1350772147'

Subtask #4:

score: 0
Wrong Answer

Test #4:

score: 0
Wrong Answer
time: 16ms
memory: 1212kb

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:

wrong answer 13th numbers differ - expected: '754517476', found: '-1495704690'

Subtask #5:

score: 0
Wrong Answer

Test #5:

score: 0
Wrong Answer
time: 15ms
memory: 1216kb

input:

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

output:

-1
-1
-1
-1
-1204772137
-1
-1385052312
-1385052312
-1
-1
-1896090173
-1896090173
-1896090173
-189609...

result:

wrong answer 5th numbers differ - expected: '-1', found: '-1204772137'

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
-1329876773
-1329876...

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
-1527440646
-1527440646
-1527440646
-1527440646...

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
-1272471751
-1337463322
-1337463322
-1398961541
-1398961541
-17372480...

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: