QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#72560#5430. TriangeltalJerryTcl100 ✓110ms9656kbC++141.1kb2023-01-16 15:46:592023-01-16 15:47:01

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-01-16 15:47:01]
  • 评测
  • 测评结果:100
  • 用时:110ms
  • 内存:9656kb
  • [2023-01-16 15:46:59]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 7;
int n, a[N], d[N], r[N];
int Get(int rk) { return a[d[rk]]; }
int main() {
	scanf("%d", &n), iota(d + 1, d + 1 + n, 1);
	for(int i = 1; i <= n; ++i) scanf("%d", a + i);
	sort(d + 1, d + 1 + n, [&](int x, int y) { return a[x] < a[y]; });
	for(int mx2 = n - 1; mx2 >= Get(n); --mx2) {
		if(Get(mx2) + Get(n) <= mx2) {
			if(Get(Get(mx2)) + Get(mx2) + Get(n) > n) continue;
			for(int i = mx2 + 1; i <= n; ++i) r[d[i]] = 1;
			for(int i = mx2 - Get(n) + 1; i <= mx2; ++i) r[d[i]] = 2;
			for(int i = Get(mx2) + 1; i <= mx2 - Get(n); ++i) r[d[i]] = 1;
			for(int i = 1; i <= Get(mx2); ++i) r[d[i]] = 3;
		} else if(Get(mx2) + Get(n) < n) {
			int mx3 = Get(mx2) + Get(n);
			if(Get(mx3) > n - mx3) continue;
			for(int i = mx3 + 1; i <= n; ++i) r[d[i]] = 1;
			for(int i = mx2 + 1; i <= mx3; ++i) r[d[i]] = 3;
			for(int i = mx2 - Get(n) + 1; i <= mx2; ++i) r[d[i]] = 2;
			for(int i = 1; i <= mx2 - Get(n); ++i) r[d[i]] = 3;
		} else continue;
		puts("YES"); for(int i = 1; i <= n; ++i) printf("%d", r[i]); return 0;
	}
	return puts("NO"), 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 14
Accepted

Test #1:

score: 14
Accepted
time: 3ms
memory: 7672kb

input:

3
1 1 1

output:

YES
321

result:

ok Correct

Test #2:

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

input:

3
2 2 2

output:

NO

result:

ok Correct

Test #3:

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

input:

10
1 1 1 1 1 1 1 1 1 1

output:

YES
3111111121

result:

ok Correct

Test #4:

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

input:

10
3 3 3 3 3 3 3 3 3 3

output:

YES
3331112221

result:

ok Correct

Test #5:

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

input:

10
4 4 4 4 4 4 4 4 4 4

output:

NO

result:

ok Correct

Test #6:

score: 0
Accepted
time: 12ms
memory: 8116kb

input:

99999
33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 33333 ...

output:

YES
22222222222211111111111112222222222222222222222221111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222211111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct

Test #7:

score: 0
Accepted
time: 60ms
memory: 9432kb

input:

500000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

YES
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct

Test #8:

score: 0
Accepted
time: 75ms
memory: 9452kb

input:

500000
166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666 166666...

output:

YES
22222222222221111111111111111111222222222222222222222222222221111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222221111111111111111111111111111111111111111111111111111...

result:

ok Correct

Test #9:

score: 0
Accepted
time: 46ms
memory: 8424kb

input:

500000
166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667 166667...

output:

NO

result:

ok Correct

Test #10:

score: 0
Accepted
time: 43ms
memory: 8416kb

input:

500000
500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000 500000...

output:

NO

result:

ok Correct

Subtask #2:

score: 16
Accepted

Test #11:

score: 16
Accepted
time: 3ms
memory: 7924kb

input:

3
1 1 1

output:

YES
321

result:

ok Correct

Test #12:

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

input:

3
1 2 2

output:

NO

result:

ok Correct

Test #13:

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

input:

9
3 3 3 3 3 3 3 3 3

output:

YES
333112221

result:

ok Correct

Test #14:

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

input:

10
2 3 1 4 3 1 4 3 4 2

output:

YES
3132232213

result:

ok Correct

Test #15:

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

input:

10
1 9 5 4 3 9 4 6 5 1

output:

NO

result:

ok Correct

Test #16:

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

input:

10
5 3 2 2 3 2 5 3 3 3

output:

YES
1233231222

result:

ok Correct

Test #17:

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

input:

10
5 1 1 1 1 5 5 1 5 4

output:

YES
1222211213

result:

ok Correct

Test #18:

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

input:

10
1 1 1 1 7 1 7 1 2 1

output:

YES
2222121232

result:

ok Correct

Test #19:

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

input:

10
3 3 3 2 5 3 2 5 2 2

output:

YES
2223123132

result:

ok Correct

Test #20:

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

input:

10
5 3 3 3 3 3 5 2 2 3

output:

NO

result:

ok Correct

Test #21:

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

input:

10
2 2 7 7 1 1 1 1 1 1

output:

NO

result:

ok Correct

Test #22:

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

input:

10
1 3 1 3 3 2 4 1 5 2

output:

YES
3232221312

result:

ok Correct

Test #23:

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

input:

3
1 2 2

output:

NO

result:

ok Correct

Subtask #3:

score: 11
Accepted

Test #24:

score: 11
Accepted
time: 1ms
memory: 7724kb

input:

4
1 1 1 1

output:

YES
3121

result:

ok Correct

Test #25:

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

input:

5
2 2 1 1 1

output:

YES
21332

result:

ok Correct

Test #26:

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

input:

3
3 1 1

output:

NO

result:

ok Correct

Test #27:

score: 0
Accepted
time: 72ms
memory: 9436kb

input:

500000
1 2 3 1 2 3 2 2 3 3 1 1 2 3 1 1 2 3 1 3 2 1 2 3 1 3 3 3 1 2 3 2 2 2 1 3 1 2 2 2 2 3 3 1 3 3 1 2 2 3 1 2 3 2 2 1 1 1 3 2 3 1 1 2 3 1 2 1 1 1 1 1 1 3 3 1 2 2 2 2 3 2 2 1 3 3 3 2 1 3 1 1 1 1 2 3 3 3 3 2 2 3 1 1 1 2 2 1 3 3 3 2 2 3 3 1 2 3 2 3 2 2 2 2 2 3 1 3 2 1 2 1 2 2 2 1 1 1 1 2 1 3 1 1 1 1 2...

output:

YES
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct

Test #28:

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

input:

9
3 3 3 3 3 3 3 3 3

output:

YES
333112221

result:

ok Correct

Test #29:

score: 0
Accepted
time: 69ms
memory: 9532kb

input:

500000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

YES
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

result:

ok Correct

Test #30:

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

input:

8
3 3 3 3 3 3 3 3

output:

NO

result:

ok Correct

Test #31:

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

input:

8
2 2 3 2 3 2 1 3

output:

YES
33212231

result:

ok Correct

Test #32:

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

input:

6
1 2 3 2 2 1

output:

YES
321223

result:

ok Correct

Test #33:

score: 0
Accepted
time: 4ms
memory: 7896kb

input:

6
1 3 2 3 1 1

output:

YES
213122

result:

ok Correct

Test #34:

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

input:

6
2 2 1 1 3 3

output:

NO

result:

ok Correct

Subtask #4:

score: 23
Accepted

Dependency #2:

100%
Accepted

Test #35:

score: 23
Accepted
time: 0ms
memory: 7604kb

input:

3000
946 211 1053 111 456 1294 810 1329 967 1198 256 1323 97 1318 109 1436 778 460 277 78 1345 190 13 183 340 557 504 1183 1190 1049 174 362 1304 1001 843 1065 453 605 472 1418 1046 1478 353 843 1024 723 656 1099 921 1102 604 959 1434 1294 1295 541 635 739 516 908 1445 1380 832 1293 62 43 82 879 70 ...

output:

NO

result:

ok Correct

Test #36:

score: 0
Accepted
time: 4ms
memory: 5900kb

input:

3000
30 556 623 1011 135 983 737 231 804 760 1071 646 296 540 689 934 410 391 393 488 200 830 396 592 154 605 880 400 368 653 1080 898 529 881 250 1088 325 881 877 38 482 435 265 426 351 569 1013 503 855 636 1073 363 307 81 322 59 457 240 923 101 551 359 614 546 283 353 849 519 424 793 574 918 412 6...

output:

YES
31123223222131121331323131213122123232231131312121233333132313113321121211122222222222213123331212222212233123323211333233323313122321223312313322212113232312331332322122112333312312333223321331323113113122233131231322212222233121112121323313232213212132231213221232322213331222121111133131133333...

result:

ok Correct

Test #37:

score: 0
Accepted
time: 5ms
memory: 7772kb

input:

3000
1936 2558 2469 2070 19 603 1655 1032 2508 75 1532 1671 209 2848 338 2834 2846 205 2895 1944 480 1394 1867 265 1473 1032 1332 1979 77 551 2748 185 1609 1762 1507 1972 1684 2605 396 2722 486 1967 670 2018 2934 2015 2215 308 911 604 1788 15 203 2772 2449 2791 2458 2100 1055 2862 740 258 1343 2672 ...

output:

NO

result:

ok Correct

Test #38:

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

input:

3000
1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 ...

output:

YES
21111122222212222222222111111111111111111111111222222222222222222222222222222222222222222222221111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222...

result:

ok Correct

Test #39:

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

input:

3000
500 1000 500 500 1000 500 1000 1000 1500 1000 1000 1000 1000 500 1500 1000 1000 1500 1000 500 1000 1000 1500 1000 500 1000 1000 1000 500 1000 1500 1000 1000 1000 1000 1000 1000 500 1000 1000 1000 500 1500 500 500 1500 500 1000 1000 500 500 1000 500 1000 500 1500 1000 500 500 500 1500 1000 500 1...

output:

YES
32332322122223122123221232223212222223222313313223323231233312322223213232221233222213222222322221231323232123333221323223332121322222333231213222222122131122122313322321232222332323221121322123133123313122223233323232311222321213123222231223232233223322232323322232311122312132332231323133211313...

result:

ok Correct

Test #40:

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

input:

3000
1000 1500 1500 1000 1000 1000 500 500 500 1000 500 500 500 1500 1500 1000 1500 1500 1500 500 1500 1000 500 500 500 1500 1500 500 500 1000 1000 500 1000 1500 500 1500 1500 1000 500 500 1500 500 1500 500 1500 500 1500 500 1500 1000 500 500 500 500 1500 500 1000 500 1500 1000 1000 500 1500 500 100...

output:

YES
31133322232221131112132221122332312113221212121213222212321332123212222121111332211121232232122112223231211232212221313112322322222322111323122121121222122132311113222332133223222212211222232331222221222223121222212322213223112332223212121211223311111322132112322232232222112232112112222122231323...

result:

ok Correct

Test #41:

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

input:

3000
1500 500 500 1500 1000 1500 500 500 1000 1500 1500 1000 500 1500 1500 1000 1500 500 500 1000 1500 1500 500 1000 1000 1000 500 1000 1500 500 1500 1000 1500 500 1500 1500 500 500 500 1500 1000 500 1500 500 500 500 500 1500 1500 500 1500 500 500 500 500 500 500 1500 500 1500 1500 1500 1000 1500 15...

output:

NO

result:

ok Correct

Test #42:

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

input:

3000
2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2...

output:

YES
22222222222222222222222222222222222232222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222...

result:

ok Correct

Test #43:

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

input:

3000
1000 999 1001 1001 999 1001 999 999 1001 999 1000 999 1001 999 1000 1000 1000 1000 1001 1001 1001 999 1000 1000 1001 1001 1000 1000 1001 1000 1000 1000 1001 1001 1001 999 999 999 999 1001 1001 1001 1000 1000 999 1000 1001 999 999 1000 1000 999 999 999 1001 1001 1000 1000 1001 1001 1000 1001 100...

output:

YES
32112122123212333311123311331333111222211133231223322211331131322313122213332232133332221311221312332213212323233121112113321213313323121221232121121112221123313311223313112122211332321213331113113131313121133132213331312133113322112321113231212232321311321231113313223232132331122133131321321113...

result:

ok Correct

Test #44:

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

input:

3000
1000 999 999 999 1001 1000 1000 1000 999 999 1001 999 999 1001 999 1000 999 1001 999 1001 1001 1001 1000 1001 1001 1000 1000 999 999 999 1000 1000 999 1000 1001 1001 999 1001 1001 999 999 1001 1000 999 999 1001 1001 1001 1000 1000 999 999 1001 1000 1001 1001 1001 999 1000 1000 999 1001 1001 100...

output:

NO

result:

ok Correct

Test #45:

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

input:

3000
500 1500 500 500 1000 1500 500 1500 1500 500 500 500 500 500 500 1500 1500 1500 1000 500 500 500 500 1500 500 1000 1500 1500 500 1500 1500 1500 1000 1000 500 1500 499 1499 500 1500 1500 500 500 1500 500 500 1500 500 1500 500 1500 500 500 1000 1500 1000 500 1500 500 500 1500 1500 500 1500 1500 1...

output:

YES
21223121122222211132222123112111332121211221221212122313212211211131122121212222223222122133211122223213121222111213233112113213322321211121212213121322313231312123121113121122112211211211211122133212212222112222222122221323332311221231222332111222221122211122232212211112213321222232123112212223...

result:

ok Correct

Subtask #5:

score: 36
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #46:

score: 36
Accepted
time: 87ms
memory: 9164kb

input:

500000
206683 149403 100051 60566 227661 69324 153148 193329 149233 122123 124155 164163 59896 22307 28638 207076 24957 82961 1746 143886 28313 235247 244761 105363 209301 66751 117250 192245 31513 34908 108799 26754 131274 51174 105538 192566 221101 194910 29614 234984 209439 94073 101334 31990 102...

output:

NO

result:

ok Correct

Test #47:

score: 0
Accepted
time: 86ms
memory: 7920kb

input:

500000
367492 384999 184260 21161 109059 497007 230955 188722 321918 306008 478775 360059 446071 58076 373158 53590 245847 372793 127111 186065 295913 87452 4873 286811 228106 33698 196763 136804 432997 142517 304362 178726 228588 2667 475749 184954 6453 11587 351759 314058 435152 410402 229442 1215...

output:

NO

result:

ok Correct

Test #48:

score: 0
Accepted
time: 33ms
memory: 8760kb

input:

300000
100000 100000 100000 100000 100000 100000 50000 100000 100000 150000 100000 100000 100000 100000 150000 50000 50000 100000 100000 50000 150000 50000 150000 50000 100000 150000 50000 100000 50000 100000 100000 50000 50000 150000 100000 50000 100000 100000 50000 50000 50000 50000 100000 50000 1...

output:

YES
22222232212222133223131321323223312322333323222332113333332223333323322221333232212222222123332122221323232312222313122222122322122222123223231233332321213222231213132122222312232123233223231132231231222222132323221333322222223323221223133223223221322221311322113221232123213213223332233222312322...

result:

ok Correct

Test #49:

score: 0
Accepted
time: 58ms
memory: 8716kb

input:

300000
50000 150000 50000 50000 50000 50000 50000 150000 50000 50000 100000 150000 150000 50000 50000 150000 50000 150000 100000 150000 150000 100000 50000 100000 50000 50000 50000 150000 50000 50000 150000 50000 50000 100000 50000 150000 50000 150000 150000 150000 100000 150000 50000 50000 50000 15...

output:

YES
21222221223112212131132322212212232121113122213222111222111132211331212212122222123211111111122312311121322211112212121122222212221222232311212113111122112321122221111232232123223311331121322132211222212121232332212221221312212133221122113122222312111223121122122122231221222322112121122112213221...

result:

ok Correct

Test #50:

score: 0
Accepted
time: 25ms
memory: 7908kb

input:

300000
100000 100000 150000 150000 150000 150000 150000 50000 50000 100000 150000 50000 150000 50000 150000 150000 50000 150000 50000 50000 150000 150000 50000 50000 50000 150000 50000 150000 150000 50000 50000 50000 50000 50000 150000 100000 150000 50000 150000 150000 50000 50000 50000 100000 50000...

output:

NO

result:

ok Correct

Test #51:

score: 0
Accepted
time: 60ms
memory: 9432kb

input:

500000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

YES
22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222...

result:

ok Correct

Test #52:

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

input:

500000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

NO

result:

ok Correct

Test #53:

score: 0
Accepted
time: 54ms
memory: 9500kb

input:

500000
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3...

output:

YES
22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222...

result:

ok Correct

Test #54:

score: 0
Accepted
time: 87ms
memory: 9500kb

input:

500000
199998 199997 199999 209997 210000 200000 199996 209998 89998 89999 199997 199997 90000 199998 199999 200000 199998 199999 199996 90000 209999 209998 210000 199997 209997 199999 199998 89999 89998 199997 199997 199999 209999 89997 199993 89998 199999 199994 199998 89999 200000 89996 90000 199...

output:

YES
22211221332232222223111212233222132322232332221332213323123323331212112122323232222113333232222223221113312332123323122231133133222313322112332333222333323331322122332332233221312213123313212212232233222321222222322233321232132223232312332232311133313333123332222232212212122323323333121222313231...

result:

ok Correct

Test #55:

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

input:

500000
166665 166662 166665 166667 166667 166666 166668 166668 166666 166661 166663 166665 166662 166664 166668 166661 166666 166664 166663 166668 166668 166663 166666 166663 166667 166664 166664 166665 166662 166665 166665 166666 166666 166665 166666 166666 166667 166665 166664 166662 166664 166666...

output:

YES
13122222233133232332232323313112212221333223323212323312223312112313313331232322322231333233211332323122213232233231323221212233123122213211133223331213311333233332332211222322223133133223312333323333133122323331333233223223232312333133333332332312312233232211123133323221132331322311112323223323...

result:

ok Correct

Test #56:

score: 0
Accepted
time: 48ms
memory: 8936kb

input:

500000
166665 166667 166668 166667 166665 166668 166667 166667 166667 166665 166667 166668 166667 166668 166667 166665 166668 166665 166668 166668 166668 166668 166668 166668 166667 166665 166668 166667 166665 166667 166667 166667 166667 166665 166668 166667 166668 166668 166668 166667 166668 166668...

output:

NO

result:

ok Correct

Test #57:

score: 0
Accepted
time: 68ms
memory: 9488kb

input:

500000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

YES
22222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222...

result:

ok Correct

Test #58:

score: 0
Accepted
time: 110ms
memory: 9656kb

input:

500000
105760 146693 34690 104825 6922 17354 103212 144121 33617 81313 164032 130487 100630 158246 8488 124407 35495 106959 43994 100600 35203 38928 27734 64937 161032 141580 116349 103127 4453 107878 5083 74005 27689 7927 45133 120683 158637 2287 143724 31016 72851 47984 143175 108872 126393 151063...

output:

YES
12313312312212323131333122213131333223231321221213322133113122233113311213212121121331132313333132321321321322133223123311213111222332121223331222221222222232233132111111233111133323321232121222111132233221222133232232212311231323121232332321333133312311232331321311221311213321312231332212221113...

result:

ok Correct