QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#138406#367. Long Mansionwaldi#10 103ms4320kbC++17991b2023-08-11 17:48:432024-07-04 01:36:56

Judging History

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

  • [2024-07-04 01:36:56]
  • 评测
  • 测评结果:10
  • 用时:103ms
  • 内存:4320kb
  • [2023-08-11 17:48:43]
  • 提交

answer

#include<bits/stdc++.h>
#define FOR(i,p,k) for(int i=(p);i<=(k);++i)
#define REP(i,n) FOR(i,0,(n)-1)
using namespace std;

int main(){
	int n;
	scanf("%d", &n);
	vector<int> wym(n);
	FOR(i, 1, n-1) scanf("%d", &wym[i]);
	vector<vector<int>> klucze(n+1);
	FOR(i, 1, n){
		int m, a;
		scanf("%d", &m);
		while(m--) scanf("%d", &a), klucze[i].emplace_back(a);
	}
	
	vector<int> lewo(n+1), prawo(n+1);
	auto wylicz = [&](int w){
		lewo[w] = prawo[w] = w;
		vector<bool> czy(n+1, 0);
		for(int i : klucze[w]) czy[i] = 1;
		while(1){
			bool koniec = 1;
			if(1<lewo[w] && czy[wym[lewo[w]-1]]){
				--lewo[w], koniec = 0;
				for(int i : klucze[lewo[w]]) czy[i] = 1;
			}
			if(prawo[w]<n && czy[wym[prawo[w]]]){
				++prawo[w], koniec = 0;
				for(int i : klucze[prawo[w]]) czy[i] = 1;
			}
			if(koniec) return;
		}
	};
	
	FOR(i, 1, n) wylicz(i);
	
	int q;
	scanf("%d", &q);
	while(q--){
		int a, b;
		scanf("%d%d", &a, &b);
		printf(lewo[a]<=b&&b<=prawo[a] ? "YES\n" : "NO\n");
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 2ms
memory: 4124kb

input:

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

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO...

result:

ok 5000 lines

Test #2:

score: 0
Accepted
time: 21ms
memory: 3908kb

input:

3000
1 4 1 3 3 4 1 2 4 1 2 3 4 2 3 4 4 1 3 1 4 2 2 4 3 3 2 1 3 2 1 3 4 4 3 2 3 2 2 4 4 1 1 3 4 1 4 1 4 1 3 3 4 1 2 1 2 4 2 1 2 1 2 3 3 3 4 2 3 2 1 2 2 1 1 1 1 1 3 3 4 1 4 4 4 4 4 1 2 4 2 2 3 3 4 2 4 3 1 2 4 1 2 1 4 1 4 4 1 3 4 3 1 2 1 3 3 2 1 2 1 2 2 4 3 3 2 4 3 3 3 1 2 1 2 4 4 1 4 1 2 1 4 4 2 2 4 2...

output:

NO
YES
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
NO
YES
YES
NO
YES
YES
YES
NO
NO
NO
YES
NO
NO
YES
YES
YES
NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
NO
YES
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
YES
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO...

result:

ok 5000 lines

Test #3:

score: 0
Accepted
time: 55ms
memory: 4320kb

input:

5000
1 2 1 1 2 1 2 2 1 1 1 1 1 2 1 1 1 1 2 1 1 1 1 1 1 2 2 2 1 2 1 2 2 2 1 2 2 1 1 1 2 1 2 2 2 1 2 2 2 2 2 2 2 2 1 2 1 1 2 2 2 2 1 2 2 2 1 2 2 2 1 1 1 1 1 2 2 1 2 1 2 2 1 1 2 1 1 2 1 2 2 1 2 2 1 1 2 1 1 1 2 2 2 2 2 1 1 1 1 2 2 1 2 2 1 2 1 2 2 1 2 2 1 2 2 2 2 1 1 1 1 2 1 2 1 1 1 1 2 2 2 2 1 1 2 1 1 1...

output:

YES
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
YES
NO
YES
YES
YES
NO
YES
NO
NO
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
YES
...

result:

ok 5000 lines

Test #4:

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

input:

2000
583 580 319 242 218 934 584 174 18 1224 1376 793 803 842 1430 1269 1442 225 1470 376 1017 352 1081 587 689 582 492 930 918 1266 105 598 1273 343 1047 1499 247 1409 1061 1246 1248 324 1362 1254 208 1448 1438 58 1125 270 1029 355 555 212 881 1232 1093 351 1353 1436 236 498 28 635 187 1439 1257 14...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
...

result:

ok 5000 lines

Test #5:

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

input:

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

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YE...

result:

ok 5000 lines

Test #6:

score: 0
Accepted
time: 6ms
memory: 3920kb

input:

2000
393 319 1075 467 1727 78 1638 314 1362 1450 906 1073 899 1271 1520 1329 1545 170 962 1240 234 1392 593 184 1177 1387 426 130 1896 1179 407 1322 607 1589 1825 1959 1525 1442 499 1177 139 998 682 1095 1944 1626 1161 917 831 1289 553 1406 653 644 1694 1476 1342 451 52 881 1519 1465 792 1544 862 13...

output:

NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
...

result:

ok 5000 lines

Test #7:

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

input:

2000
1600 1598 1596 1594 1592 1590 1588 1586 1584 1582 1580 1578 1576 1574 1572 1570 1568 1566 1564 1562 1560 1558 1556 1554 1552 1550 1548 1546 1544 1542 1540 1538 1536 1534 1532 1530 1528 1526 1524 1522 1520 1518 1516 1514 1512 1510 1508 1506 1504 1502 1500 1498 1496 1494 1492 1490 1488 1486 1484 ...

output:

YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
N...

result:

ok 5000 lines

Subtask #2:

score: 5
Accepted

Dependency #1:

100%
Accepted

Test #8:

score: 5
Accepted
time: 62ms
memory: 3896kb

input:

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

output:

NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
N...

result:

ok 500000 lines

Test #9:

score: 0
Accepted
time: 59ms
memory: 4088kb

input:

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

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO...

result:

ok 500000 lines

Test #10:

score: 0
Accepted
time: 79ms
memory: 3988kb

input:

3000
4 3 4 2 2 4 1 4 4 1 1 4 3 3 3 2 2 2 2 2 4 3 2 4 2 4 2 3 3 4 1 3 2 2 2 1 3 1 3 1 1 3 2 2 1 4 4 2 1 3 3 3 2 2 2 2 3 1 3 3 4 3 3 1 4 1 2 3 3 4 4 4 3 2 3 4 2 2 1 3 4 4 1 3 3 3 1 2 2 1 4 3 4 3 4 1 1 2 1 2 1 3 1 3 3 2 3 2 4 2 4 1 3 4 1 3 3 2 2 2 4 3 3 4 1 4 2 2 4 3 1 4 1 4 2 3 2 2 3 2 2 4 4 4 3 3 1 1...

output:

NO
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
YES
YES
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
YES
YES...

result:

ok 500000 lines

Test #11:

score: 0
Accepted
time: 103ms
memory: 4288kb

input:

5000
2 1 1 2 1 1 1 1 2 2 1 1 1 2 1 2 2 1 2 1 2 2 2 2 2 1 1 1 2 1 1 2 1 2 1 1 2 1 1 1 2 2 1 1 2 1 2 1 1 2 2 1 1 1 1 2 1 1 2 1 2 2 1 1 1 1 1 1 2 1 2 2 2 1 2 1 1 2 1 1 1 1 2 1 1 1 2 1 2 2 2 2 2 2 2 2 1 1 1 2 2 1 2 1 2 1 1 1 2 1 2 1 1 2 2 1 1 1 1 2 2 1 2 2 2 1 2 1 2 1 2 2 2 1 2 2 1 2 1 2 2 1 1 2 1 2 1 1...

output:

YES
NO
NO
YES
YES
YES
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
YES
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
YES
NO
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
NO
NO
NO
YES
YES
NO
YES
YES
NO
YES
YES
NO
NO
YES
NO
YES
NO
NO
NO
YES
NO...

result:

ok 500000 lines

Test #12:

score: 0
Accepted
time: 59ms
memory: 3776kb

input:

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

output:

NO
NO
YES
NO
YES
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
YES
NO
YES
YES
NO
NO
YES
YES
YES
NO
NO
NO
YES
NO
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
NO
NO
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
NO
YES
YES
YES
YES
NO
YES
NO
NO...

result:

ok 500000 lines

Test #13:

score: 0
Accepted
time: 50ms
memory: 3836kb

input:

2000
7 934 186 622 706 491 44 653 767 868 969 459 53 784 117 200 38 884 163 351 264 227 126 798 848 198 224 13 69 271 14 428 279 247 887 469 618 312 104 665 267 100 549 798 821 628 405 254 272 965 307 579 160 700 148 94 133 866 482 431 356 155 412 478 609 24 503 808 87 173 542 661 838 261 785 294 88...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
YES
NO
N...

result:

ok 500000 lines

Test #14:

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

input:

2000
512 1028 621 489 681 387 852 266 661 1124 791 653 595 876 587 1461 1384 757 858 998 454 264 719 197 982 907 87 7 1242 879 544 1243 1062 1072 83 1069 648 1446 463 1472 455 1044 490 698 289 4 617 1459 500 947 39 272 419 859 363 247 866 1099 414 1317 715 1261 384 755 717 280 236 90 1307 410 611 45...

output:

NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES...

result:

ok 500000 lines

Test #15:

score: 0
Accepted
time: 61ms
memory: 4120kb

input:

2000
68 76 71 44 79 9 100 63 67 57 10 37 13 18 5 38 31 2 10 3 53 52 51 3 53 31 69 9 92 86 99 97 10 32 48 92 87 11 29 87 56 16 16 83 98 29 69 81 95 31 11 5 17 27 20 85 28 21 75 100 96 33 35 28 56 70 93 69 88 56 51 80 77 58 55 92 91 97 91 53 24 52 46 15 27 100 36 45 28 96 4 24 95 27 87 50 89 78 31 53 ...

output:

NO
NO
YES
YES
NO
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
...

result:

ok 500000 lines

Test #16:

score: 0
Accepted
time: 76ms
memory: 4120kb

input:

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

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 500000 lines

Test #17:

score: 0
Accepted
time: 50ms
memory: 3896kb

input:

2000
77 54 98 39 48 26 62 94 31 17 64 35 85 76 90 23 42 14 82 35 14 42 88 86 16 62 14 82 27 56 15 22 72 87 79 90 15 38 64 87 25 21 4 29 55 77 59 9 64 3 16 83 73 57 13 58 9 77 67 16 65 87 80 78 62 94 31 57 86 38 42 34 50 93 31 100 77 3 77 32 59 45 23 62 57 27 19 7 32 82 28 34 69 66 79 53 51 3 72 4 36...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES...

result:

ok 500000 lines

Test #18:

score: 0
Accepted
time: 55ms
memory: 4092kb

input:

2000
13 996 153 283 920 937 117 129 171 126 323 593 586 731 194 955 157 505 375 677 242 378 468 564 492 693 341 9 170 56 843 973 706 946 987 434 139 196 553 552 778 819 45 153 292 358 752 794 155 6 912 606 196 262 135 584 261 648 722 925 259 370 53 795 121 411 860 514 149 550 532 78 900 674 119 558 ...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
NO
NO
YES
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
Y...

result:

ok 500000 lines

Test #19:

score: 0
Accepted
time: 53ms
memory: 3856kb

input:

2000
1107 79 168 257 317 1245 730 523 1075 947 517 135 326 702 955 153 383 201 523 867 1279 971 1219 698 53 1203 982 830 277 586 658 1405 31 1142 1086 1464 421 908 859 741 222 613 593 121 668 217 105 1022 637 1239 1457 365 355 1477 1288 317 493 1228 108 784 366 490 478 255 1376 644 141 734 385 1471 ...

output:

YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
...

result:

ok 500000 lines

Test #20:

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

input:

2000
18 77 18 62 90 74 36 29 39 83 11 97 82 95 45 39 10 36 36 70 41 100 43 62 56 50 18 20 87 44 55 38 28 29 24 53 82 55 20 54 35 43 67 6 52 45 87 75 69 71 72 69 16 86 61 26 78 80 52 83 69 57 12 3 2 57 3 1 94 79 6 85 41 20 1 68 51 22 3 11 30 97 92 51 58 53 71 71 19 50 50 37 82 100 25 82 71 9 79 9 27 ...

output:

NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
NO...

result:

ok 500000 lines

Test #21:

score: 0
Accepted
time: 76ms
memory: 3928kb

input:

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

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 500000 lines

Test #22:

score: 0
Accepted
time: 63ms
memory: 3852kb

input:

2000
892 53 1960 1156 1451 1304 1017 721 115 1386 735 1627 726 127 8 1950 117 668 1384 526 521 1878 766 236 287 1932 1925 1860 1663 1038 1990 727 1245 40 219 704 1944 671 94 1700 1345 1766 1888 699 1206 1869 1462 726 1707 311 910 956 586 247 479 1877 785 166 254 1170 906 164 1245 950 873 1241 1758 1...

output:

NO
YES
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
N...

result:

ok 500000 lines

Test #23:

score: 0
Accepted
time: 53ms
memory: 3916kb

input:

2000
1600 1598 1596 1594 1592 1590 1588 1586 1584 1582 1580 1578 1576 1574 1572 1570 1568 1566 1564 1562 1560 1558 1556 1554 1552 1550 1548 1546 1544 1542 1540 1538 1536 1534 1532 1530 1528 1526 1524 1522 1520 1518 1516 1514 1512 1510 1508 1506 1504 1502 1500 1498 1496 1494 1492 1490 1488 1486 1484 ...

output:

NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO...

result:

ok 500000 lines

Test #24:

score: 0
Accepted
time: 61ms
memory: 3860kb

input:

2000
1600 1598 1596 1594 1592 1590 1588 1586 1584 1582 1580 1578 1576 1574 1572 1570 1568 1566 1564 1562 1560 1558 1556 1554 1552 1550 1548 1546 1544 1542 1540 1538 1536 1534 1532 1530 1528 1526 1524 1522 1520 1518 1516 1514 1512 1510 1508 1506 1504 1502 1500 1498 1496 1494 1492 1490 1488 1486 1484 ...

output:

YES
NO
NO
NO
YES
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
YES...

result:

ok 500000 lines

Test #25:

score: 0
Accepted
time: 56ms
memory: 3924kb

input:

2000
1600 1598 1596 1594 1592 1590 1588 1586 1584 1582 1580 1578 1576 1574 1572 1570 1568 1566 1564 1562 1560 1558 1556 1554 1552 1550 1548 1546 1544 1542 1540 1538 1536 1534 1532 1530 1528 1526 1524 1522 1520 1518 1516 1514 1512 1510 1508 1506 1504 1502 1500 1498 1496 1494 1492 1490 1488 1486 1484 ...

output:

NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
N...

result:

ok 500000 lines

Test #26:

score: 0
Accepted
time: 59ms
memory: 4124kb

input:

2000
1800 1798 1796 1794 1792 1790 1788 1786 1784 1782 1780 1778 1776 1774 1772 1770 1768 1766 1764 1762 1760 1758 1756 1754 1752 1750 1748 1746 1744 1742 1740 1738 1736 1734 1732 1730 1728 1726 1724 1722 1720 1718 1716 1714 1712 1710 1708 1706 1704 1702 1700 1698 1696 1694 1692 1690 1688 1686 1684 ...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO...

result:

ok 500000 lines

Subtask #3:

score: 0
Time Limit Exceeded

Test #27:

score: 0
Time Limit Exceeded

input:

100000
2 7 4 20 14 19 16 3 15 15 6 18 12 2 2 16 14 15 2 9 5 16 12 6 10 9 18 6 15 11 7 15 20 7 12 1 12 17 4 19 15 5 6 19 3 1 6 18 19 15 3 1 3 3 16 8 20 20 1 3 3 11 1 4 5 20 10 2 19 9 13 20 11 11 5 9 19 3 19 16 13 7 16 20 8 9 19 14 11 9 9 20 16 20 7 6 13 15 3 4 15 15 4 10 15 3 16 5 18 17 19 7 7 2 10 2...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%