QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#356635#8298. Erasing Numberskevinyang#AC ✓147ms3912kbC++171.1kb2024-03-18 06:17:112024-03-18 06:17:11

Judging History

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

  • [2024-03-18 06:17:11]
  • 评测
  • 测评结果:AC
  • 用时:147ms
  • 内存:3912kb
  • [2024-03-18 06:17:11]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	cin.tie(nullptr)->sync_with_stdio(false);
	int t;
	cin >> t;
	while(t--){
		int n;
		cin >> n;
		vector<int>a(n+1);
		for(int i = 1; i<=n; i++){
			cin >> a[i];
		}
		for(int i = 1; i<=n; i++){
			vector<int>arr(n+1);
			if(a[i]==(n+1)/2){
				cout << "1";
				continue;
			}
			int rq = 0;
			if(a[i]<(n+1)/2){
				for(int j = 1; j<=n; j++){
					if(a[j]>a[i])arr[j] = 1;
				}
			}
			else{
				for(int j = 1; j<=n; j++){
					if(a[j]<a[i])arr[j] = 1;
				}
			}
			rq = abs((n+1)/2-a[i]);
			int cur = 0;
			for(int j = 1; j<i; j++){
				if(arr[j] == 1){
					cur++;
					if(cur==3){
						rq--;
						cur = 1;
					}
				}
				else{
					cur--;
					cur = max(cur,0LL);
				}
			}
			cur = 0;
			for(int j = i+1; j<=n; j++){
				if(arr[j] == 1){
					cur++;
					if(cur==3){
						rq--;
						cur = 1;
					}
				}
				else{
					cur--;
					cur = max(cur,0LL);
				}
			}
			if(rq<=0){
				cout << '1';
			}
			else{
				cout << '0';
			}
		}
		cout << '\n';
	}
	return 0;
}

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

详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3624kb

input:

2
5
3 1 2 5 4
3
2 3 1

output:

10001
100

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 2ms
memory: 3548kb

input:

1000
3
1 2 3
3
1 3 2
3
2 1 3
3
2 3 1
3
3 1 2
3
3 2 1
5
1 2 3 4 5
5
1 2 3 5 4
5
1 2 4 3 5
5
1 2 4 5 3
5
1 2 5 3 4
5
1 2 5 4 3
5
1 3 2 4 5
5
1 3 2 5 4
5
1 3 4 2 5
5
1 3 4 5 2
5
1 3 5 2 4
5
1 3 5 4 2
5
1 4 2 3 5
5
1 4 2 5 3
5
1 4 3 2 5
5
1 4 3 5 2
5
1 4 5 2 3
5
1 4 5 3 2
5
1 5 2 3 4
5
1 5 2 4 3
5
1 5 3...

output:

010
001
100
100
001
010
01110
01101
01010
01001
01010
01001
01010
01001
01000
01001
01000
01001
00010
00001
00100
00101
00001
00011
00010
00001
00100
00101
00001
00011
10110
10101
10010
10001
10010
10001
01010
01001
01000
11000
01000
11000
00010
00001
00100
10100
00001
10010
00010
00001
00100
10100
...

result:

ok 1000 lines

Test #3:

score: 0
Accepted
time: 2ms
memory: 3544kb

input:

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

output:

110000100
10110001000
000000101
11000101100
110000010
01010001001
001101010
11100100001
100100010
00110011101
101100010
00010010011
100001011
01101100110
010010001
10000000010
010001001
11000000010
100110010
01000000100
100110010
01000001001
110110010
00100000010
001010001
01110010101
001010001
0100...

result:

ok 1000 lines

Test #4:

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

input:

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

output:

101101110001011001001011011011011110011111011010100
1111001111011001111111011101101101110111001011101
100000100110101000000100011110111000100010110001011
1111011100101010110011111001101101101100100110110
010000110011101111001111010011110100010110100101011
10111111011110111110010111111100101000100011...

result:

ok 200 lines

Test #5:

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

input:

20
501
378 417 430 131 56 175 236 332 458 188 355 44 270 390 183 228 319 359 391 139 258 297 140 201 296 227 300 326 67 473 23 350 267 2 1 344 273 241 94 404 272 60 459 314 330 366 218 250 310 123 212 146 162 161 157 288 415 370 360 500 220 452 160 433 68 474 280 328 129 338 132 78 318 43 203 66 365...

output:

111111111111111111111111111110011001111111111111111111111110111110111111111110111111011101001111111111111010101011110111111111100101111111111100111111101111110101101011111111101111101110101101011111111111111111111111111110111011111011101101111111101111101111110110111111111011111111111111110111111010...

result:

ok 20 lines

Test #6:

score: 0
Accepted
time: 147ms
memory: 3912kb

input:

2
4999
1236 4601 1818 4996 3521 309 126 4188 2927 643 1417 4361 3038 3945 1947 4417 3943 4680 4736 3306 4981 2107 4777 4528 149 2901 3869 4789 4358 1958 263 3147 4667 2569 1274 1686 1079 1038 2502 4423 4994 4093 4286 4017 4569 576 1395 1005 3962 3538 935 3157 981 3326 679 672 168 3770 3397 4231 4521...

output:

111011111111111111110111111111111111111101111111111111111111111111111111111111111111111111111111011111111111111111110111111111111111111111111111111111111111111110111111111111111111111111111111011111111111111111111111111111111111111111111111111011101111110111111111111111111111111111111111111111111111...

result:

ok 2 lines

Test #7:

score: 0
Accepted
time: 80ms
memory: 3912kb

input:

2
4999
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

output:

011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 2 lines

Test #8:

score: 0
Accepted
time: 85ms
memory: 3672kb

input:

2
4999
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 2793 68 69 486 71 72 73 74 75 76 77 619 79 80 81 82 83 84 85 86 87 88 89 90 91 92 4098 94 95 96 97 98 99...

output:

011111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 2 lines

Test #9:

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

input:

2
4999
2581 444 4256 3 3496 1263 4650 3895 672 4161 519 4327 4289 4897 3433 718 4423 280 2077 4325 709 1682 3043 3885 1779 974 2156 2272 4566 3729 4837 2986 682 2210 3575 36 1644 3740 4591 1302 1416 4015 1200 2567 4494 2795 1309 3744 4146 1046 4144 891 3532 177 3960 56 258 4139 4849 1909 3952 3355 8...

output:

111011111111101111111111111111111110111111111111111111101111111110111101111111111111111111111111111110011111111111111111111111111101111111111011111111111111111111111111111111111111111111111111111111111111111111101011111111110111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok 2 lines

Test #10:

score: 0
Accepted
time: 24ms
memory: 3612kb

input:

10
999
91 364 822 651 286 639 433 83 679 606 765 46 979 852 644 654 332 642 5 665 371 803 778 428 866 25 722 614 617 334 893 760 846 20 431 121 158 714 333 805 271 222 206 869 827 467 358 877 101 905 727 800 159 754 47 615 876 584 260 475 592 41 122 882 975 851 655 382 855 52 404 523 476 570 175 54 ...

output:

111111111110011111011111101111111011111111111111111111011111101101111011111001111001111111011101110111111011101111101111011111111110111111111111110111110111011110111111111111111101101101110111111111110111111111101111111111110111111111111111111111011111111111111011111110101110111111101111010111111101...

result:

ok 10 lines

Test #11:

score: 0
Accepted
time: 39ms
memory: 3828kb

input:

5
1999
687 1779 62 1696 129 1394 277 1908 278 1743 851 1576 61 1577 491 1056 861 1738 387 1108 591 1532 223 1546 425 1116 934 1676 604 1584 325 1010 871 1134 823 1599 459 1787 911 1411 376 1198 463 1343 854 1593 791 1416 295 1855 615 1635 466 1458 422 1821 797 1120 641 1581 272 1098 415 1815 105 194...

output:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...

result:

ok 5 lines

Extra Test:

score: 0
Extra Test Passed