QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#168295 | #7075. Let's Play Jigsaw Puzzles! | supepapupu# | AC ✓ | 275ms | 24768kb | C++17 | 1.1kb | 2023-09-08 08:15:01 | 2023-09-08 08:15:01 |
Judging History
answer
#include <bits/stdc++.h>
#define x first
#define y second
#define el '\n'
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int N = 1010, INF = 0x3f3f3f3f, mod = 998244353;
inline int read() {
int f = 1, k = 0;
char c = getchar();
while (c < '0' || c > '9') {
if (c == '-') f = -1;
c = getchar();
}
while (c >= '0' && c <= '9') {
k = k * 10 + c - '0';
c = getchar();
}
return f * k;
}
int g[N][N];
int u[N * N], d[N * N], l[N * N], r[N * N];
pii pos[N * N];
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int n;
cin >> n;
int S;
for (int i = 1; i <= n * n; ++i) {
cin >> u[i] >> d[i] >> l[i] >> r[i];
if (u[i] == -1 && l[i] == -1) S = i;
}
g[1][1] = S;
for (int i = 1; i <= n; ++i) {
for (int j = 1; j <= n; ++j) {
if (i != n) g[i + 1][j] = d[g[i][j]];
if (j != n) g[i][j + 1] = r[g[i][j]];
cout << g[i][j] << " \n"[j == n];
}
}
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 3ms
memory: 13884kb
input:
2 -1 3 -1 2 -1 4 1 -1 1 -1 -1 4 2 -1 3 -1
output:
1 2 3 4
result:
ok 2 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 13908kb
input:
42 1244 1713 1584 265 1100 1445 250 397 108 1161 26 940 1084 1119 1579 576 485 176 1251 781 917 1361 883 209 568 1162 44 368 1614 914 378 604 1059 687 1373 988 537 911 559 1649 1155 1685 352 1724 434 863 1367 298 963 41 1261 288 601 590 1554 1281 1714 -1 608 979 83 199 1072 1075 984 1411 1592 293 10...
output:
1559 1618 550 492 198 145 1622 466 443 646 676 1428 1586 1569 287 76 1144 445 184 760 1038 888 96 722 24 1683 1096 867 619 1632 683 58 290 512 422 1489 621 1736 1478 1221 1507 1316 878 1142 194 1504 344 1278 1065 615 1582 321 1486 1000 295 1481 916 1198 1274 596 1617 307 110 706 860 708 499 1077 109...
result:
ok 42 lines
Test #3:
score: 0
Accepted
time: 9ms
memory: 13832kb
input:
256 59514 55419 18661 2338 18386 44586 37892 7259 45565 43343 44074 39100 8065 51340 31460 61704 1973 54946 26716 14567 8587 43850 10746 46526 1524 55529 62814 1688 13757 56306 9426 55901 52993 2600 16483 10803 35724 11123 64064 24411 58936 6877 50578 15423 36123 3907 25662 1943 17529 53198 11065 21...
output:
50480 9217 42060 41140 1637 44728 17637 13364 58165 13517 9342 52869 4960 43953 3003 32969 30463 21433 10454 22904 26709 44841 19606 4884 23773 30214 51867 44107 47603 10352 58401 13531 39883 58086 34112 32340 64041 62812 11430 32759 31018 61827 37348 36242 30647 49901 62107 62704 30535 21688 5267 5...
result:
ok 256 lines
Test #4:
score: 0
Accepted
time: 12ms
memory: 13840kb
input:
191 23698 13626 29860 31441 7887 24322 34398 30334 11126 35201 21463 958 11392 30085 2647 17939 28938 2441 9857 732 33598 19941 3810 35849 27476 2838 27327 4183 1072 7423 18633 35342 36174 7868 7824 34627 14627 35047 671 29078 14845 8627 34672 17120 29124 19299 2929 33330 25356 22909 24770 22061 351...
output:
14987 20493 24634 25555 3621 103 7738 10062 15034 34212 17303 19790 12234 35418 2983 28113 26044 24472 11934 9247 25461 19014 9230 8266 10741 14643 19760 17655 17595 3454 19156 35614 28261 7869 35817 16214 9608 17594 12560 31440 22235 13425 7754 11642 21401 19487 11021 15764 2000 10331 15690 24223 2...
result:
ok 191 lines
Test #5:
score: 0
Accepted
time: 80ms
memory: 24136kb
input:
560 72203 45646 225940 84151 23200 172085 305583 148143 19187 69173 143589 115564 10858 272743 64736 305667 76731 109218 36271 20228 303160 153369 162399 44342 85997 286778 9068 169298 86396 3406 105702 124146 158790 67651 148462 224096 306846 283559 301008 245648 55166 280599 304349 281527 82496 37...
output:
224085 119845 175900 201588 239827 183008 38816 234619 5180 130373 152981 295026 134643 155470 129314 225584 99128 104274 127134 111432 183770 250071 150446 86140 82150 121370 84715 167547 10762 85146 167252 95468 153081 262541 170310 224538 133353 97274 237601 103188 67954 67257 42180 147675 193298...
result:
ok 560 lines
Test #6:
score: 0
Accepted
time: 1ms
memory: 13832kb
input:
43 1185 1849 -1 430 1682 257 899 946 1163 1530 1592 317 1678 1744 1463 1334 1592 1580 1464 1530 462 -1 571 1608 699 607 639 519 584 744 161 -1 586 703 1800 887 77 1736 1598 872 698 1076 297 45 1562 1574 718 50 435 1696 1772 589 1816 1192 258 1042 785 1841 618 1203 1231 509 1771 103 496 1522 709 1337...
output:
1821 551 1252 1073 1302 466 1787 1739 1731 1343 1784 1729 616 1551 1235 367 109 975 963 1168 1660 222 1419 1766 604 1520 754 1562 1314 396 1056 1470 1461 1123 503 577 37 1847 280 131 1637 524 1367 1268 1460 570 1638 764 1720 714 1202 978 1363 254 38 869 1782 1362 333 1839 544 1447 1239 485 1068 540 ...
result:
ok 43 lines
Test #7:
score: 0
Accepted
time: 100ms
memory: 24148kb
input:
579 90512 102801 93308 48869 331400 137671 34396 297128 117209 179703 168627 319180 117666 17573 303023 98937 31041 309597 25283 176683 286250 29553 328705 303255 299034 163378 231128 283125 275697 18465 309254 325775 138419 203716 193839 182352 324333 6110 5508 25465 45184 109255 248198 166854 1904...
output:
122400 145213 192235 211903 40022 281070 185702 163986 86738 156055 172168 222902 117447 217450 272481 71700 122315 62749 149965 82866 5097 213046 263881 1903 197253 35164 208133 40583 212442 159976 194575 221347 118114 90386 27400 222239 205673 50446 76974 258849 141657 8123 215932 99248 45129 2061...
result:
ok 579 lines
Test #8:
score: 0
Accepted
time: 58ms
memory: 24080kb
input:
488 110871 18943 90010 131829 213854 36909 92742 61484 74063 178728 207929 66184 163209 180828 93568 84875 164622 130490 163951 132221 182591 15082 136552 152122 215364 23828 55924 50723 150658 199318 72102 231016 62679 71620 48922 109254 75130 118108 51334 180247 67112 34806 84090 148041 175129 158...
output:
231228 106356 70555 187978 7592 23531 63412 222255 147410 232002 58890 34812 85386 115744 4391 34972 130589 93173 56740 203402 39016 107638 154674 32714 12904 85412 233480 17728 41685 34904 185708 225173 145548 57890 83520 56529 228995 84062 84952 99206 141413 80521 19291 229046 93370 38999 46973 14...
result:
ok 488 lines
Test #9:
score: 0
Accepted
time: 240ms
memory: 23760kb
input:
1000 169030 118433 902236 978629 84782 72306 11244 989711 960726 25357 932157 864236 224317 160222 176503 202676 991085 45686 945176 923522 216182 224394 214439 917827 63493 105551 942441 77579 133778 937237 22921 141341 235245 208679 99377 137036 175065 220128 84501 81633 18459 934111 36668 32948 9...
output:
717275 839251 820342 819731 777206 755128 830744 922869 827771 730526 923468 895417 850510 921376 689112 848438 770274 786129 771367 811202 879981 864286 864431 920737 889950 774662 831137 802344 841036 811646 898420 823958 937028 655064 863681 761050 602563 931559 758048 696766 815214 837646 789862...
result:
ok 1000 lines
Test #10:
score: 0
Accepted
time: 269ms
memory: 24028kb
input:
1000 12294 881706 37874 951460 64897 989185 28913 35608 92832 66030 151051 143320 168050 93533 948106 26285 30286 139040 77144 127140 33756 196655 221959 188554 991368 978063 885715 27956 134361 850069 991549 974952 980834 947030 836030 941708 208324 227365 137729 209468 100060 152204 34704 921849 1...
output:
657933 795503 860909 872862 892394 900516 713420 752224 712648 824551 885203 705474 785436 804572 889949 810074 892987 675758 871414 788507 778055 726825 732817 909840 892314 871542 727787 859061 658582 894669 654215 683441 781885 823483 814034 868416 682365 836366 829529 797887 675241 751476 723096...
result:
ok 1000 lines
Test #11:
score: 0
Accepted
time: 275ms
memory: 24308kb
input:
1000 211571 330764 272003 240341 184846 178651 954572 101860 72682 944310 979153 937166 171821 930316 61323 119144 925124 86820 49208 166913 817439 64464 948991 937464 16019 973210 48223 104999 25767 84024 976606 95281 109646 107646 149811 96509 190703 164777 953550 150570 7374 934738 989497 903390 ...
output:
739116 823486 819562 822887 730959 807853 887678 871334 945458 875075 804666 853967 882153 725420 781810 784652 852285 796528 651927 747391 698221 823014 802841 810376 620931 832403 846185 765549 889848 630691 774150 769723 783787 722891 837537 839326 779899 832159 794970 639479 866690 875172 784592...
result:
ok 1000 lines
Test #12:
score: 0
Accepted
time: 262ms
memory: 24136kb
input:
1000 60628 38250 828278 87194 175036 85447 49738 82098 78458 979621 911179 28823 85070 60293 900404 75723 54470 239770 162005 111742 876881 974007 959877 996148 892085 888129 916423 907250 142133 153150 110857 115758 124554 4388 139962 161927 95735 160639 190410 168245 24513 78758 851320 985071 9174...
output:
839535 920402 741809 782006 753099 733166 779548 840983 894444 775452 779654 799226 821387 835594 722746 804382 832557 776676 654291 820941 832015 877954 702639 772050 810764 677043 590201 760914 733267 833416 616974 783170 896208 799257 896513 845319 856774 812142 887793 842595 851974 910181 832480...
result:
ok 1000 lines
Test #13:
score: 0
Accepted
time: 247ms
memory: 24452kb
input:
1000 267738 143166 161103 197191 977242 37147 93750 85326 971446 101688 13018 134297 858549 887300 62668 950332 896040 745234 989212 968600 2944 991674 833331 72608 855417 945576 -1 881096 999840 106223 69461 977587 980343 925835 952178 957993 109197 34172 966860 139943 152296 125261 68408 174069 88...
output:
672907 828327 910068 854192 685177 839700 723018 829211 809100 898926 732551 906535 828693 850229 818062 834208 908125 805269 814086 817786 840062 898411 588345 876538 890100 785451 900629 857420 871887 939921 836533 892523 819953 811430 856595 831434 834465 717075 630601 729351 868996 807039 796764...
result:
ok 1000 lines
Test #14:
score: 0
Accepted
time: 248ms
memory: 24140kb
input:
1000 58521 120788 912857 121287 64851 52515 110151 778474 783472 987228 906045 21410 66424 64962 47702 190774 757995 962293 921099 954062 121556 116221 64118 109495 895951 984405 825207 2929 57333 924111 42046 52340 30186 991607 702080 932892 833339 838268 953578 849757 990546 145077 114526 86669 94...
output:
830380 902195 878464 728926 829967 856221 742880 868496 799167 797945 751052 689763 822246 767436 895729 766425 663582 783174 745844 741906 802371 733948 856452 815123 857696 703539 732697 776018 863192 897604 646596 820067 686322 681525 866237 743357 819079 875490 835913 783785 843808 753716 858478...
result:
ok 1000 lines
Test #15:
score: 0
Accepted
time: 256ms
memory: 24768kb
input:
1000 982769 12970 22986 984742 106724 957727 23729 933265 41688 111060 90192 19070 896801 30692 920665 940422 815579 23055 831846 992388 967333 124894 62418 64263 180716 7145 250820 63090 98406 13550 45192 906920 997772 78454 74366 25279 16974 12160 82969 860159 152497 157572 192878 173892 915372 88...
output:
816270 918928 527721 821304 834738 787443 828986 892300 773288 792477 855504 809784 677713 826872 690976 815795 742756 846822 819769 823636 814268 913388 811524 867480 832021 637437 870654 841816 785437 948967 757723 868075 877853 654873 793933 836316 820885 857937 797237 729352 885286 865884 806006...
result:
ok 1000 lines
Test #16:
score: 0
Accepted
time: 227ms
memory: 23748kb
input:
1000 999272 75663 945157 155448 123592 33700 100315 102703 14122 998368 966933 987567 925637 56302 87891 77920 5179 52670 852433 103442 928523 936771 958798 58605 944716 103545 845156 924029 986581 57767 142497 143755 8601 883330 987378 51884 897276 911311 713477 902854 954901 128595 22672 999998 30...
output:
778624 683131 907340 730490 696273 824577 815308 784838 807979 901467 823373 738777 829281 896251 859462 897033 890489 757584 937720 747899 775896 866221 715708 707175 865759 766702 854112 839700 717965 826994 783957 700647 920213 833498 694611 860155 784436 923940 819501 894565 712497 733645 891296...
result:
ok 1000 lines
Test #17:
score: 0
Accepted
time: 1ms
memory: 13884kb
input:
1 -1 -1 -1 -1
output:
1
result:
ok single line: '1'