QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#20941#1833. Deletingconqueror_of_zky#TL 3812ms103728kbC++201.8kb2022-02-21 18:19:512022-05-03 12:02:57

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-03 12:02:57]
  • 评测
  • 测评结果:TL
  • 用时:3812ms
  • 内存:103728kb
  • [2022-02-21 18:19:51]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i, l, r) for(int i = (l); i <= (r); i ++)
#define per(i, r, l) for(int i = (r); i >= (l); i --)
#define trv(i, u, v) for(int i = head[u], v = e[i].to; i; v = e[i = e[i].nxt].to)
#define fi first
#define se second
#define all(s) s.begin(), s.end()
#define sz(s) (int)(s.size())
#define lb(s) ((s) & -(s))
#define pb push_back
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
mt19937_64 hua(time(0));
template<typename T> inline bool chkmx(T &x, T y) {return x < y ? x = y, 1 : 0;}
template<typename T> inline bool chkmn(T &x, T y) {return y < x ? x = y, 1 : 0;}
template<int T> using A = array<int, T>;

inline int read() {
	int x = 0, f = 1; char c = getchar();
	for(; !isdigit(c); c = getchar()) if(c == '-')  f = 0;
	for(; isdigit(c); c = getchar()) x = x * 10 + c - '0';
	return f ? x : -x;
}
const int maxn = 4000;
const int maxm = 4000000;
int n, w[maxn + 5][maxn + 5]; 
bitset<maxn + 5> f[maxn + 5], g[maxn + 5], cur[maxn + 5];
A<3> s[maxm + 5];
int tp;
inline void seta(int l, int r) {
	f[l][r] = g[r][l] = 1;
	if(cur[l - 1][r + 1] && !f[l  - 1][r + 1]) seta(l - 1, r + 1);
	bitset<maxn + 5> x = f[r + 1] & ~f[l];
	for(int p = x._Find_first(); p <= n; p = x._Find_next(p)) seta(l, p); 
	bitset<maxn + 5> y = g[l - 1] & ~g[r];
	for(int p = y._Find_first(); p <= n; p = y._Find_next(p)) seta(p, r); 
}
int main() {
	//freopen("in.txt", "r", stdin);
	n = read();
	rep(i, 1, n) for(int j = i + 1; j <= n; j += 2) w[i][j] = read(), s[++ tp] = {w[i][j], i, j};
	sort(s + 1, s + tp + 1);	
	rep(i, 0, n) g[i][i + 1] = f[i + 1][i] = 1;
	rep(i, 1, tp) { 
		int l = s[i][1], r = s[i][2];
		cur[l][r] = 1;
		if(!f[l][r] && f[l + 1][r - 1]) seta(l, r);
		if(f[1][n]) {
			cout << s[i][0] << '\n';
			return 0;
		}
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 5ms
memory: 11868kb

input:

2
1

output:

1

result:

ok 1 number(s): "1"

Test #2:

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

input:

6
2 1 3
4 5
6 7
8
9

output:

6

result:

ok 1 number(s): "6"

Test #3:

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

input:

10
20 21 2 11 25
3 24 18 8
6 17 7 5
22 4 23
14 15 1
19 16
12 10
13
9

output:

14

result:

ok 1 number(s): "14"

Test #4:

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

input:

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

output:

30

result:

ok 1 number(s): "30"

Test #5:

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

input:

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

output:

54

result:

ok 1 number(s): "54"

Test #6:

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

input:

100
750 481 1065 911 1943 427 1633 45 1841 234 1376 1075 1603 1682 1581 1284 28 5 1567 1540 2409 1430 695 667 1246 392 1183 1090 594 1481 524 2023 354 778 584 827 1516 796 1675 1829 189 1688 706 1679 1483 1010 1209 1393 399 210
40 149 1040 351 1435 320 340 577 898 449 1896 224 2168 1456 1222 1216 19...

output:

1289

result:

ok 1 number(s): "1289"

Test #7:

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

input:

100
561 1112 852 529 2112 323 265 2038 1970 1681 556 2261 887 277 1171 553 1887 48 2432 266 1304 1764 853 2205 2320 1532 571 1870 193 544 1135 874 2132 1162 102 2179 2307 2068 1990 1111 2420 2077 1779 2000 1996 2297 1981 450 1091 992
140 2474 744 537 42 1051 1086 1685 1307 1282 2387 167 31 1179 301 ...

output:

1082

result:

ok 1 number(s): "1082"

Test #8:

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

input:

1000
168625 248587 13361 216812 183629 130592 94183 152417 64237 66548 133370 190254 121255 46138 62441 214340 158394 100935 199720 242242 28785 185956 49195 170727 64011 159665 14265 193684 148792 234339 35901 173675 21572 54311 108353 180276 8738 219185 221308 163715 86748 23949 144379 9144 66996 ...

output:

100069

result:

ok 1 number(s): "100069"

Test #9:

score: 0
Accepted
time: 169ms
memory: 37768kb

input:

2000
629753 453642 891406 271214 387757 205701 185083 533150 543744 346137 296803 8558 894334 685905 530329 660631 215508 749020 272754 548476 388081 623465 444491 267448 890422 788334 439713 48112 46778 39381 526152 419546 857234 306443 430102 627368 891680 622422 4172 521593 904148 871179 212505 4...

output:

382553

result:

ok 1 number(s): "382553"

Test #10:

score: 0
Accepted
time: 432ms
memory: 65084kb

input:

3000
780886 1272177 1981093 155764 1004024 2161066 2163860 1999899 1724418 2201045 1323203 386344 488844 98545 509647 660171 1911299 406766 566172 354749 65644 2064030 227791 613327 1446376 959116 1172810 2054662 479633 1239569 2070554 342062 1473376 1014363 1180623 1537364 2000637 903391 1796402 40...

output:

855449

result:

ok 1 number(s): "855449"

Test #11:

score: 0
Accepted
time: 464ms
memory: 65112kb

input:

3000
2151832 2040056 1820723 1647821 1989057 1438174 197301 2013861 1084109 1533178 1103873 1079635 1122200 380122 1741860 642218 137487 931199 98296 60463 929185 6804 2227061 1415272 1354710 2247351 2071905 1384180 589332 342057 411231 1069014 1813211 547349 1357495 1279819 209870 697345 849679 579...

output:

871233

result:

ok 1 number(s): "871233"

Test #12:

score: 0
Accepted
time: 584ms
memory: 65120kb

input:

3000
586185 739549 1512231 1576382 2124572 849993 259309 831983 1334988 1451320 838166 1344126 1721886 2217163 1041397 3821 1616533 942750 121005 2151935 661341 1751969 903062 1195769 1060979 893206 2162517 1129906 120059 1497730 286110 972028 269871 1670619 820006 1345011 950494 1701096 840150 9661...

output:

865389

result:

ok 1 number(s): "865389"

Test #13:

score: 0
Accepted
time: 542ms
memory: 65236kb

input:

3000
1838973 959493 468493 927886 325485 2015622 357872 2200246 1739668 76441 583587 578097 232536 268705 165522 1089532 2059535 233795 870754 1087324 1657808 22588 209194 1608421 326009 294431 1477964 789126 1280065 285509 1271181 1878718 1389793 35287 1120513 866529 1616607 176594 113345 2153274 1...

output:

857976

result:

ok 1 number(s): "857976"

Test #14:

score: 0
Accepted
time: 445ms
memory: 65004kb

input:

3000
2086761 540330 271330 2008226 990669 2021055 1090954 675002 1458191 1923206 946292 462231 1507637 397979 1156215 1492372 680422 1684765 1481640 1319997 338590 1945324 780771 398966 679166 297644 1204407 814416 195896 149004 837831 344985 939834 1594285 833326 135053 995307 151940 1280365 130315...

output:

887030

result:

ok 1 number(s): "887030"

Test #15:

score: 0
Accepted
time: 726ms
memory: 101904kb

input:

4000
1898521 2797950 963899 3568439 2519564 1914791 3738898 2159691 3247655 2698362 3974995 1182541 2046569 2815025 699396 227205 999269 1909823 2956594 3628363 2431691 92591 2797302 1413639 762460 1804303 3044744 3414120 3827117 814343 2913293 3505010 3893338 3738481 274918 1801763 646495 2013403 1...

output:

1530061

result:

ok 1 number(s): "1530061"

Test #16:

score: 0
Accepted
time: 1196ms
memory: 101916kb

input:

4000
401966 1123581 1483128 1015860 899861 1782096 363484 250066 48695 674899 2230114 3502283 150698 1377108 976341 3346711 3027103 82354 295204 2806448 2155765 3517266 726926 1877590 3777786 98729 522034 1962443 2505254 2271688 2373070 3865631 2324550 1512900 2831294 1994732 3353955 1605618 2499103...

output:

1497257

result:

ok 1 number(s): "1497257"

Test #17:

score: 0
Accepted
time: 1113ms
memory: 101884kb

input:

4000
3408963 1557574 3885378 908767 2100726 3216886 1836502 2996617 695667 737582 1129451 2631024 2636219 3142495 1157816 193289 2199516 1253117 3558135 998853 1627008 3772175 3226000 311075 2168393 1127644 1442406 1600423 1943606 2518098 2968107 1430113 1634386 1450013 2871781 3041783 1611518 56351...

output:

1557358

result:

ok 1 number(s): "1557358"

Test #18:

score: 0
Accepted
time: 790ms
memory: 101872kb

input:

4000
3747268 2973261 2114940 3344365 2641415 2838557 1412150 117065 3684548 3521046 2796693 2118849 1460642 1170178 2123285 2622054 1095885 1343309 2522941 953831 1633126 2605418 2923444 1333417 2435431 426960 1219681 2907289 3410643 3779269 807781 255702 2978498 1229718 3383424 2353667 705549 11822...

output:

1557776

result:

ok 1 number(s): "1557776"

Test #19:

score: 0
Accepted
time: 683ms
memory: 101700kb

input:

4000
350642 888151 3032656 2497397 106426 104424 1332946 1322390 875742 2666476 1664828 1524231 754112 1059202 513184 1642386 2643967 722644 3698254 2639508 33426 1068293 3718000 3834488 2453068 3799639 3581555 1724942 1308002 2121238 985441 2449996 3246215 770646 550151 1629773 413548 1512066 20242...

output:

1490168

result:

ok 1 number(s): "1490168"

Test #20:

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

input:

10
10 22 14 24 13
17 19 12 8
23 15 16 25
9 20 21
11 7 18
6 5
2 4
3
1

output:

15

result:

ok 1 number(s): "15"

Test #21:

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

input:

100
1278 2224 1761 1343 2165 1839 1335 1633 1722 1709 2435 1794 1716 1975 996 2308 2383 759 1373 2149 1670 1162 1652 2228 1273 1909 1309 1195 2315 689 1772 947 1627 1226 1095 1678 1892 2005 2207 2356 739 1523 1745 2157 2011 1001 1595 1708 2140 2393
1286 904 1776 2351 2185 944 1349 1851 2466 1690 116...

output:

1355

result:

ok 1 number(s): "1355"

Test #22:

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

input:

100
889 986 1158 2387 2433 1545 2041 878 2396 1966 2272 2497 1660 822 1200 1468 2372 2030 2370 2330 1995 1081 1949 1185 1647 614 1720 1539 1682 2346 920 447 959 1373 2470 766 943 2251 2125 809 2465 1370 1162 467 1473 403 2119 906 1954 898
2258 1784 1066 402 1345 1947 1575 1141 1988 499 1146 1212 217...

output:

1012

result:

ok 1 number(s): "1012"

Test #23:

score: 0
Accepted
time: 107ms
memory: 22080kb

input:

1000
95066 190079 110943 126201 145785 249441 193010 154048 176441 195319 228756 67535 116016 181268 238036 195327 214173 71808 142292 67457 142277 193826 99315 203516 78210 220786 162522 229399 153360 249909 118683 147388 205755 156001 188956 122384 140947 167559 245236 96192 108911 222418 106642 2...

output:

121159

result:

ok 1 number(s): "121159"

Test #24:

score: 0
Accepted
time: 825ms
memory: 38656kb

input:

2000
818527 859714 894820 701939 727779 949924 851304 809390 749837 856654 906069 987992 644003 804290 910834 784525 835333 686263 854980 823017 904625 890453 836105 912419 649438 842639 818603 673412 837240 963441 993075 686198 887833 717271 834965 730199 828343 943295 898159 988693 934079 714441 7...

output:

714844

result:

ok 1 number(s): "714844"

Test #25:

score: 0
Accepted
time: 1241ms
memory: 65356kb

input:

3000
1040084 1606685 1147737 893133 799272 1691635 1778676 1976393 791666 2238456 1262046 1665944 1971655 1374558 1481779 853096 1891287 2118783 1004058 1674761 1834878 1405591 1275586 581758 1454548 1598274 1554291 875876 1271394 897306 741524 1005201 1811173 2101905 1688766 1615895 1168924 932795 ...

output:

1133028

result:

ok 1 number(s): "1133028"

Test #26:

score: 0
Accepted
time: 2135ms
memory: 102932kb

input:

4000
3575898 1546411 1559554 3328823 1686565 2526296 2409574 3620919 1209251 1200984 1397613 3124453 3864170 1398129 1895521 3461772 2945166 1421299 2620562 1092951 3232032 1581735 2640286 3777167 3402523 1405172 2151925 1316394 2347476 3220621 1569470 3973365 2982874 3375649 3135385 3286780 3870511...

output:

1982991

result:

ok 1 number(s): "1982991"

Test #27:

score: 0
Accepted
time: 3812ms
memory: 103596kb

input:

4000
2965944 3724390 3226529 3646537 3572894 3369242 3417207 2978424 3630555 3582312 3311500 2441045 3172808 2258299 2479388 3544825 2940671 3328961 2732329 3711939 3796665 3232686 2268292 3176278 2775706 2257193 2352163 3658761 2705818 3462886 2422830 2519653 3749417 3884830 3241218 2779221 2846442...

output:

2699840

result:

ok 1 number(s): "2699840"

Test #28:

score: 0
Accepted
time: 1176ms
memory: 102380kb

input:

4000
3180099 3897498 3461935 1509701 1131945 2003860 2908145 1206744 3599111 3173736 1188327 2687380 1985214 2170336 2728336 2752061 3482921 3822448 3074702 1665883 3147148 376877 555207 852697 470908 1635333 3010100 1957107 651843 3210996 281398 3252143 1112574 1693306 3286031 1848098 3113275 19539...

output:

1630644

result:

ok 1 number(s): "1630644"

Test #29:

score: 0
Accepted
time: 3214ms
memory: 103544kb

input:

4000
3935892 3958332 3962711 3912411 3810797 3882998 3857681 3899665 3917537 3880117 3890994 3809505 3993556 3845473 3915673 3852839 3896134 3849467 3867642 3906309 3982896 3968272 3811244 3927284 3900520 3967066 3858889 3835261 3966104 3886519 3839062 3895535 3813909 3845779 3990184 3960721 3889169...

output:

3811656

result:

ok 1 number(s): "3811656"

Test #30:

score: 0
Accepted
time: 1569ms
memory: 102764kb

input:

4000
3999001 3998259 3999211 3998544 3999474 3999886 3999860 3999829 3998985 3999140 3999858 3998518 3999577 3999768 3998690 3998867 3999611 3998349 3998772 3998044 3999418 3998756 3998472 3998699 3998548 3998526 3998766 3998097 3999056 3998627 3998154 3999861 3998941 3999203 3999426 3999661 3999848...

output:

3998001

result:

ok 1 number(s): "3998001"

Test #31:

score: 0
Accepted
time: 1489ms
memory: 102448kb

input:

4000
3999252 3994695 3997443 3995461 3994322 3998810 3994936 3995164 3994577 3999658 3996067 3994136 3995977 3996647 3994430 3996503 3996340 3997517 3997239 3997876 3994894 3994421 3994473 3996967 3994896 3999859 3999905 3996674 3995281 3995800 3998725 3998439 3995517 3998692 3999591 3999511 3998896...

output:

3994006

result:

ok 1 number(s): "3994006"

Test #32:

score: 0
Accepted
time: 2438ms
memory: 103728kb

input:

4000
3982510 3983310 3995938 3982250 3980766 3994629 3999961 3993620 3999762 3994982 3994000 3987739 3996200 3999101 3998056 3995158 3992251 3981418 3988898 3993117 3984556 3997554 3991814 3996399 3999891 3998422 3997013 3996963 3987923 3995609 3980145 3982665 3994574 3997892 3996611 3990075 3989174...

output:

3980100

result:

ok 1 number(s): "3980100"

Test #33:

score: -100
Time Limit Exceeded

input:

4000
3638112 3906980 3937577 3809106 3743103 3787112 3826015 3788791 3652048 3986656 3666295 3654440 3788647 3928085 3634556 3823277 3798929 3814466 3636804 3918209 3803650 3695333 3867204 3803743 3896923 3737106 3617778 3892368 3878653 3732419 3923465 3628585 3894623 3814444 3682829 3945621 3917192...

output:


result: