QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#478535#8488. Squaresrania__#AC ✓548ms50520kbC++232.3kb2024-07-15 04:46:462024-07-15 04:46:47

Judging History

你现在查看的是最新测评结果

  • [2024-07-15 04:46:47]
  • 评测
  • 测评结果:AC
  • 用时:548ms
  • 内存:50520kb
  • [2024-07-15 04:46:46]
  • 提交

answer

#pragma GCC optimize("O3,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef int in;
#define int long long
#define double long double
#define f first
#define s second
#define pb push_back
#define pp push
#define ceill(x,y) ((x/y)+(x%y!=0)*(x/abs(x)*y/abs(y)<0?0:1))
#define floorr(x,y) ((x/y)+(x%y!=0)*(x/abs(x)*y/abs(y)<0?-1:0))
#define YN(x) cout<<(x?"YES\n":"NO\n");
#define Yn(x) cout<<(x?"Yes\n":"No\n");
#define yn(x) cout<<(x?"yes\n":"no\n");
const int MAAX=1e18;
const int MOD=1e9+7;
const int MAX=1e9;

map<pair<int,int>,int> mp;
map<int,int> mp1,mp2,mp3,mp4;

in main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int tc=1;
    // cin>>tc;
    while(tc--){
		int q;
		cin>>q;
		int a=0,b=0,c=0,d=0;
		while(q--){
			int x,y;
			cin>>x>>y;
			if(mp[{x,y}]){
				if(y%2){
					int e=max(mp1[x],mp2[x]);
					mp1[x]--;
					int f=max(mp1[x],mp2[x]);
					if(f<e){
						if(x%2)
							a--;
						else
							b--;
					}
				}
				else{
					int e=max(mp1[x],mp2[x]);
					mp2[x]--;
					int f=max(mp1[x],mp2[x]);
					if(f<e){
						if(x%2)
							a--;
						else
							b--;
					}
				}
				if(x%2){
					int e=max(mp3[y],mp4[y]);
					mp3[y]--;
					int f=max(mp3[y],mp4[y]);
					if(f<e){
						if(y%2)
							c--;
						else
							d--;
					}
				}
				else{
					int e=max(mp3[y],mp4[y]);
					mp4[y]--;
					int f=max(mp3[y],mp4[y]);
					if(f<e){
						if(y%2)
							c--;
						else
							d--;
					}
				}
			}
			else{
				if(y%2){
					int e=max(mp1[x],mp2[x]);
					mp1[x]++;
					int f=max(mp1[x],mp2[x]);
					if(f>e){
						if(x%2)
							a++;
						else
							b++;
					}
				}
				else{
					int e=max(mp1[x],mp2[x]);
					mp2[x]++;
					int f=max(mp1[x],mp2[x]);
					if(f>e){
						if(x%2)
							a++;
						else
							b++;
					}
				}
				if(x%2){
					int e=max(mp3[y],mp4[y]);
					mp3[y]++;
					int f=max(mp3[y],mp4[y]);
					if(f>e){
						if(y%2)
							c++;
						else
							d++;
					}
				}
				else{
					int e=max(mp3[y],mp4[y]);
					mp4[y]++;
					int f=max(mp3[y],mp4[y]);
					if(f>e){
						if(y%2)
							c++;
						else
							d++;
					}
				}
			}
			mp[{x,y}]=!mp[{x,y}];
			cout<<max(max(a,b),max(c,d))<<"\n";
		}
    }
    return 0;
}

这程序好像有点Bug,我给组数据试试?

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3648kb

input:

5
1 1
2 2
3 3
4 4
1 1

output:

1
1
2
2
2

result:

ok 5 number(s): "1 1 2 2 2"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

6
1000000000 1000000000
1 1
2 1
3 1
2 1
1 1

output:

1
1
2
2
2
1

result:

ok 6 numbers

Test #3:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

1
1 1

output:

1

result:

ok 1 number(s): "1"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

5
564718673 358502890
690430685 632939232
585325539 365329221
564718673 358502890
412106895 291882089

output:

1
2
3
2
3

result:

ok 5 number(s): "1 2 3 2 3"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3720kb

input:

20
509061481 552472140
764514676 914746017
509061481 552472140
862937826 103626886
387546138 832279893
759454419 427833657
473906880 203664913
677780684 519361360
473906880 203664913
954478790 346543678
694729965 875591136
16115810 148658854
13062847 965187713
387546138 832279893
862937826 103626886...

output:

1
1
1
2
3
3
4
5
4
5
5
6
6
5
4
5
5
6
6
5

result:

ok 20 numbers

Test #6:

score: 0
Accepted
time: 1ms
memory: 3716kb

input:

200
554612960 302221568
116916725 968305282
801014437 268165778
789506731 306131459
13368943 886840315
363360799 905409275
116924266 559605009
852605130 958211588
109650034 425467938
141467305 650548044
431039587 745738115
155599305 621666083
828917500 741000657
12409889 485667004
180000773 86391114...

output:

1
2
3
3
4
5
5
5
5
6
7
8
8
9
10
11
12
12
13
14
15
16
17
17
17
18
19
20
21
20
21
22
22
23
23
22
22
22
22
23
24
24
25
25
25
25
25
26
27
28
28
29
30
29
29
29
30
30
31
31
32
33
34
35
35
36
37
38
38
38
38
39
40
41
42
42
41
42
43
43
44
44
43
43
44
44
44
45
46
47
47
47
47
46
47
47
47
47
47
48
49
48
48
49
49...

result:

ok 200 numbers

Test #7:

score: 0
Accepted
time: 3ms
memory: 4128kb

input:

2000
899264438 476622704
986340445 648824891
740810634 932820965
286168356 171585713
598847965 782836303
521217452 683785318
33823244 153622905
10996384 289693682
586672384 586886777
701495711 928292835
986751934 79716878
841260487 689387897
630110529 667834847
269231735 181271834
348686125 54078317...

output:

1
1
2
3
4
4
5
6
7
7
8
8
9
9
10
11
12
12
12
12
12
13
14
15
16
17
17
17
18
19
19
19
20
21
22
22
23
24
24
24
25
26
26
26
26
27
28
29
30
31
31
31
31
32
32
33
34
35
35
36
37
38
39
39
39
40
41
42
42
42
43
44
45
46
46
47
48
48
49
49
49
50
50
51
51
52
53
54
54
55
56
56
57
57
58
59
59
59
59
60
60
61
61
61
62...

result:

ok 2000 numbers

Test #8:

score: 0
Accepted
time: 37ms
memory: 8396kb

input:

20000
845307873 551670649
426179753 585145446
272072460 42832322
708468026 369512227
707306260 333912144
179958894 105463041
709323964 340008991
56700751 275437432
166918961 233357935
64649425 986947524
567429377 474961684
523832375 243962714
232519436 659525392
959761744 945530605
43516963 11961433...

output:

1
2
2
2
3
4
5
5
5
5
6
7
8
8
9
9
10
10
10
10
11
12
12
13
14
15
15
15
15
16
16
17
18
19
19
20
20
20
20
21
22
22
23
24
24
24
25
25
26
26
26
26
27
28
29
29
30
31
32
32
33
34
34
35
36
36
37
38
39
40
41
41
41
42
42
42
42
43
43
44
44
44
44
45
46
47
48
48
49
49
49
49
50
50
50
50
51
51
52
52
52
53
54
54
55
5...

result:

ok 20000 numbers

Test #9:

score: 0
Accepted
time: 548ms
memory: 50520kb

input:

200000
227237525 519592686
31955822 746044570
875788231 16040525
622670574 802536533
843076248 393268875
457326124 988955927
338408653 324864333
184459587 793869106
275997548 920778469
826265679 617000381
20411011 523427796
372940759 769441930
841210032 701040139
63648511 605105249
204474813 9994808...

output:

1
2
2
2
3
4
5
5
6
7
7
7
8
9
10
10
10
11
12
12
13
13
14
15
16
17
18
19
19
19
20
21
21
22
23
24
25
26
27
28
28
29
29
29
29
30
31
31
32
32
32
33
33
34
34
34
35
35
35
36
36
36
36
36
37
37
37
37
38
39
39
39
40
40
40
41
42
42
43
43
44
44
45
45
46
47
47
48
48
49
49
50
50
51
51
52
52
53
54
55
56
56
56
57
57...

result:

ok 200000 numbers

Test #10:

score: 0
Accepted
time: 51ms
memory: 3636kb

input:

200000
136350299 215989922
860226674 856709716
88731452 141260628
973060074 856709716
330492734 376797231
973060074 141260628
88731452 141260628
860226674 927526414
860226674 927526414
777269158 215989922
136350299 215989922
973060074 856709716
136350299 533380674
136350299 927526414
330492734 21598...

output:

1
2
3
4
4
5
4
5
4
5
5
4
4
5
6
6
5
6
7
7
8
9
10
10
11
12
11
10
9
9
9
9
9
9
10
10
10
10
9
10
9
10
10
10
11
12
12
11
11
11
12
12
12
11
10
11
11
11
11
11
12
13
12
11
12
11
12
12
11
12
12
13
12
13
12
11
11
11
10
11
11
11
10
10
10
10
11
12
11
12
11
11
10
11
11
12
11
11
12
12
13
13
14
15
16
16
15
14
14
14
...

result:

ok 200000 numbers

Test #11:

score: 0
Accepted
time: 51ms
memory: 3728kb

input:

200000
105578035 9776769
523536139 565677698
852979121 9776769
508576158 565677698
566840627 294940418
852979121 294940418
523536139 241619400
694351736 565677698
566840627 294940418
852979121 364134117
105578035 565677698
105578035 294940418
852979121 9776769
694351736 565677698
566840627 565677698...

output:

1
2
3
3
4
4
5
5
4
5
5
6
5
5
6
6
6
6
6
7
8
8
8
9
9
9
9
9
8
8
8
8
8
8
7
7
7
8
8
8
8
8
8
8
8
8
9
8
8
8
8
9
9
9
9
9
9
9
8
8
8
8
8
8
8
9
9
8
8
8
9
9
9
9
9
8
7
7
7
8
8
8
8
8
9
9
9
10
9
9
9
8
8
8
9
9
9
9
10
11
12
11
11
11
11
11
10
10
9
9
9
9
9
9
9
9
9
8
8
9
9
8
8
9
9
9
9
9
9
9
9
9
9
9
9
9
8
9
9
9
8
9
9
8
8...

result:

ok 200000 numbers

Test #12:

score: 0
Accepted
time: 44ms
memory: 3636kb

input:

200000
779838474 613894390
693499611 646438299
391692286 613894390
693499611 613894390
779838474 583325613
391692286 583325613
673700989 583325613
305845373 613894390
673700989 613894390
673700989 972281581
693499611 583325613
693499611 972281581
73913277 385858758
73913277 613894390
673700989 64643...

output:

1
1
2
2
2
3
3
3
3
4
5
6
7
8
9
8
8
8
8
8
9
9
9
9
9
9
9
9
10
10
11
10
10
10
10
10
10
10
10
10
10
10
10
10
9
9
9
9
8
8
8
7
8
9
8
8
8
8
8
8
8
8
8
7
7
7
6
7
7
7
7
7
7
8
8
7
8
8
7
6
5
5
5
5
6
7
8
9
9
9
9
8
8
7
6
6
6
7
7
6
6
6
7
7
7
7
7
6
6
6
5
5
5
5
6
6
7
7
7
7
7
6
6
6
6
6
7
6
7
6
6
6
7
6
6
5
5
5
5
6
6
6
...

result:

ok 200000 numbers

Test #13:

score: 0
Accepted
time: 158ms
memory: 4568kb

input:

200000
127286476 13683212
127286476 92630819
127286476 735594510
127286476 722497333
127286476 534164770
127286476 290663373
127286476 541179112
127286476 531963289
127286476 178978653
127286476 490591737
127286476 832737122
127286476 698639082
127286476 448456497
127286476 256706631
127286476 63712...

output:

1
1
2
2
3
3
4
4
5
6
6
6
7
8
8
9
10
11
12
13
14
14
15
16
17
17
18
19
20
21
21
22
22
23
23
23
24
24
24
25
26
27
27
27
27
28
28
29
30
31
32
32
32
32
33
34
34
34
34
35
36
37
38
39
40
40
40
40
41
42
42
42
42
43
43
43
43
44
44
45
46
47
48
49
50
50
49
50
50
51
51
51
52
53
52
52
52
53
53
53
53
54
55
55
55
5...

result:

ok 200000 numbers

Test #14:

score: 0
Accepted
time: 199ms
memory: 7384kb

input:

200000
303395375 998629217
303395375 335063526
303395375 283401649
303395375 579706348
303395375 855912403
303395375 575127582
303395375 470710020
303395375 746534453
303395375 513112604
303395375 419125561
303395375 940436601
303395375 293151176
303395375 582460889
303395375 381405154
303395375 154...

output:

1
1
2
2
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
12
13
13
14
15
15
15
16
17
18
19
19
19
19
19
19
20
20
21
21
22
22
23
24
25
26
27
28
29
29
29
30
30
31
31
32
33
34
34
34
35
36
36
37
38
38
38
38
38
39
39
39
40
40
41
42
43
44
45
45
46
47
48
48
48
49
49
49
49
50
51
51
52
52
52
52
53
53
54
55
55
55
56
56
...

result:

ok 200000 numbers

Test #15:

score: 0
Accepted
time: 167ms
memory: 4308kb

input:

200000
74778698 294198377
291037732 53990645
887361730 223874344
280268228 234895867
150144445 542408078
435020747 60482857
938668512 105706597
950667631 518578942
251393750 657646121
842879843 871508440
248393901 871508440
918792339 599636337
887361730 853674939
512669749 688093691
435020747 329051...

output:

1
2
3
4
4
4
5
5
6
6
6
7
8
9
9
9
10
10
10
11
12
13
13
14
15
15
15
15
16
16
17
18
18
19
19
19
20
21
21
22
22
22
22
22
23
24
24
25
25
26
27
27
27
27
27
28
28
28
28
27
27
27
27
28
28
29
29
29
29
29
30
30
31
31
31
32
32
32
33
33
33
33
33
34
35
36
37
37
38
38
38
38
38
38
38
38
39
39
40
41
42
42
42
42
43
4...

result:

ok 200000 numbers

Test #16:

score: 0
Accepted
time: 156ms
memory: 4588kb

input:

200000
450949453 56459380
746669553 56459380
328088749 56459380
505050747 56459380
735387085 56459380
477205012 56459380
8083883 56459380
189850498 56459380
445363914 56459380
806477808 56459380
807384764 56459380
743274674 56459380
531871450 56459380
535178197 56459380
582203666 56459380
51426023 5...

output:

1
2
3
4
5
5
6
6
6
6
6
6
7
7
8
8
9
9
10
11
12
12
13
14
14
15
15
16
16
17
17
17
18
19
20
21
21
21
22
23
23
24
25
26
26
26
27
27
28
29
29
30
31
32
33
34
34
35
36
37
38
39
40
40
40
41
41
42
43
42
43
43
44
45
46
46
47
47
48
48
49
50
50
50
50
50
51
50
51
51
51
51
51
51
52
53
54
54
55
56
57
57
57
57
58
59
...

result:

ok 200000 numbers

Test #17:

score: 0
Accepted
time: 197ms
memory: 7396kb

input:

200000
203381929 758981456
584160651 758981456
794845202 758981456
61655664 758981456
103944424 758981456
998965986 758981456
214528465 758981456
273695468 758981456
59730779 758981456
762935386 758981456
793003383 758981456
588494689 758981456
77451518 758981456
633940622 758981456
85444606 7589814...

output:

1
2
2
2
3
4
4
5
5
6
6
6
7
8
9
9
9
10
10
11
11
11
12
13
13
14
14
15
16
16
17
18
18
19
20
20
20
21
21
22
23
23
23
24
25
24
25
25
26
27
28
28
28
29
29
29
30
31
32
32
32
32
32
33
33
33
34
35
36
36
37
38
38
39
39
40
40
41
41
42
42
42
43
43
44
45
45
46
46
46
47
48
48
49
50
50
50
51
51
52
52
52
53
53
54
54...

result:

ok 200000 numbers

Test #18:

score: 0
Accepted
time: 208ms
memory: 7240kb

input:

200000
916614912 858380979
474442863 806647681
813449930 314289398
380791242 869025219
380791242 854242605
963132747 453167387
614492905 998835097
963132747 845182150
546195911 252121570
919022541 235776117
546195911 111317090
919022541 77083811
813449930 33638567
673726486 376483445
546195911 23452...

output:

1
2
2
3
4
5
6
6
6
7
7
8
9
10
10
10
11
12
12
12
13
13
14
14
14
14
15
16
17
18
18
19
19
19
20
21
22
22
23
24
24
24
25
26
26
26
27
27
28
28
29
30
30
30
31
31
32
32
32
32
32
32
33
33
34
34
34
35
35
35
36
36
37
37
38
39
40
40
41
41
41
41
42
42
43
44
45
45
45
45
46
47
47
47
48
49
49
49
50
50
51
52
52
52
5...

result:

ok 200000 numbers

Test #19:

score: 0
Accepted
time: 216ms
memory: 7192kb

input:

200000
440411166 768644315
954383091 768644315
490602434 579450229
522136051 10939828
116756319 853319842
442442123 10939828
290230744 853319842
35044456 768644315
863588750 684893971
705342666 332042053
142537420 853319842
439896757 282651674
904657846 282651674
438231999 768644315
113909307 853319...

output:

1
1
2
2
3
4
4
4
5
6
7
7
8
8
8
8
9
10
11
11
12
13
13
14
14
15
16
16
17
18
19
19
19
19
20
21
21
21
22
22
22
22
22
23
24
25
25
25
25
26
26
27
28
28
28
28
29
30
31
32
32
32
33
33
34
34
34
34
35
36
37
38
38
39
40
40
40
41
42
43
43
43
43
44
44
44
44
44
45
46
46
47
48
49
50
51
52
52
53
53
54
55
56
57
58
59...

result:

ok 200000 numbers

Extra Test:

score: 0
Extra Test Passed