QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#247695 | #7629. Make SYSU Great Again II | ucup-team087# | AC ✓ | 266ms | 19604kb | C++14 | 3.0kb | 2023-11-11 15:33:12 | 2023-11-11 15:33:12 |
Judging History
answer
#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
using namespace std;
using Int = long long;
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
template <class T> ostream &operator<<(ostream &os, const vector<T> &as) { const int sz = as.size(); os << "["; for (int i = 0; i < sz; ++i) { if (i >= 256) { os << ", ..."; break; } if (i > 0) { os << ", "; } os << as[i]; } return os << "]"; }
template <class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cerr << *i << " "; cerr << endl; }
template <class T> bool chmin(T &t, const T &f) { if (t > f) { t = f; return true; } return false; }
template <class T> bool chmax(T &t, const T &f) { if (t < f) { t = f; return true; } return false; }
#define COLOR(s) ("\x1b[" s "m")
constexpr int E = 13;
vector<int> seqs[E];
int getE(int n) {
if (n % 2 == 0) {
++n;
}
for (int e = 1; e < E; ++e) {
if (2 * (int)seqs[e].size() >= n) {
return e;
}
}
assert(false);
}
int a[2010][2010];
void solve(int n) {
if (n % 2 == 0) {
++n;
}
const int e = getE(n);
const int len = seqs[e].size();
for (int x = 0; x < n; ++x) for (int y = 0; y < n; ++y) {
const int hi = seqs[e][(x + y) % n % len];
const int lo = seqs[e][(x - y + n) % n % len];
a[x][y] = hi << e | lo;
}
}
int main() {
seqs[1] = {0, 1};
for (int e = 2; e < E; ++e) {
for (int i = 0; i < (int)seqs[e - 1].size(); ++i) {
seqs[e].push_back(seqs[e - 1][i] | (i & 1) << (e - 1));
}
if (seqs[e].size() % 2 == 0) seqs[e].pop_back();
for (int i = 0; i < (int)seqs[e - 1].size(); ++i) {
seqs[e].push_back(seqs[e - 1][i] | ((i & 1) ^ 1) << (e - 1));
}
// cerr<<e<<": "<<seqs[e].size()<<" "<<seqs[e]<<endl;
}
for (int e = 1; e < E; ++e) {
const int len = seqs[e].size();
for (int i = 0; i < len; ++i) {
assert(0 <= seqs[e][i]); assert(seqs[e][i] < 1 << e);
assert(!(seqs[e][i] & seqs[e][(i + 1) % len]));
}
assert(set<int>(seqs[e].begin(), seqs[e].end()).size() == seqs[e].size());
}
#ifdef LOCAL
for (int n = 1; n <= 2000; ++n) {
const int e = getE(n);
if(n<=20)cerr<<n<<": "<<e<<endl;
assert(1 << (2 * e) <= 4 * n * n);
}
#endif
int N;
for (; ~scanf("%d", &N); ) {
solve(N);
puts("Yes");
for (int x = 0; x < N; ++x) {
for (int y = 0; y < N; ++y) {
if (y) printf(" ");
printf("%d", a[x][y]);
}
puts("");
}
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5964kb
input:
4
output:
Yes 0 10 4 1 10 4 2 8 5 2 8 2 0 9 2 8
result:
ok 1
Test #2:
score: 0
Accepted
time: 1ms
memory: 3924kb
input:
1
output:
Yes 0
result:
ok 1
Test #3:
score: 0
Accepted
time: 1ms
memory: 3936kb
input:
2
output:
Yes 0 2 3 0
result:
ok 1
Test #4:
score: 0
Accepted
time: 1ms
memory: 3932kb
input:
3
output:
Yes 0 2 1 3 0 0 0 1 2
result:
ok 1
Test #5:
score: 0
Accepted
time: 1ms
memory: 3976kb
input:
5
output:
Yes 0 10 4 1 10 10 4 2 8 1 5 2 8 2 8 0 9 2 8 6 10 0 9 6 0
result:
ok 1
Test #6:
score: 0
Accepted
time: 1ms
memory: 4072kb
input:
8
output:
Yes 0 49 14 32 21 42 4 49 54 8 33 22 40 5 50 12 9 38 16 41 6 48 13 2 36 17 46 0 49 14 0 53 18 44 1 54 8 1 54 8 45 2 52 9 6 48 9 38 0 53 10 4 49 14 32 17 54 8 5 50 12 33 22 40
result:
ok 1
Test #7:
score: 0
Accepted
time: 0ms
memory: 4084kb
input:
13
output:
Yes 0 238 16 197 42 132 105 150 72 162 92 1 238 238 16 206 32 133 106 148 73 166 88 2 236 1 17 206 32 142 96 149 74 164 89 6 232 2 236 204 33 142 96 158 64 165 90 4 233 6 232 18 34 140 97 158 64 174 80 5 234 4 233 22 200 136 98 156 65 174 80 14 224 5 234 20 201 38 102 152 66 172 81 14 224 14 224 21 ...
result:
ok 1
Test #8:
score: 0
Accepted
time: 1ms
memory: 4028kb
input:
21
output:
Yes 0 234 20 201 38 136 98 156 65 174 80 5 234 20 201 38 136 98 156 65 174 238 16 202 36 137 102 152 66 172 81 14 224 21 202 36 137 102 152 66 172 1 17 206 32 138 100 153 70 168 82 12 225 30 192 37 138 100 153 70 168 2 236 204 33 142 96 154 68 169 86 8 226 28 193 46 128 101 154 68 169 6 232 18 34 14...
result:
ok 1
Test #9:
score: 0
Accepted
time: 1ms
memory: 4100kb
input:
34
output:
Yes 0 974 48 901 90 772 217 806 152 834 188 513 478 544 405 586 276 713 310 648 338 684 17 974 48 901 90 772 217 806 152 834 188 513 990 32 910 80 773 218 804 153 838 184 514 476 545 414 576 277 714 308 649 342 680 18 972 49 910 80 773 218 804 153 838 184 514 476 33 926 64 782 208 805 154 836 185 51...
result:
ok 1
Test #10:
score: 0
Accepted
time: 2ms
memory: 6284kb
input:
55
output:
Yes 0 4016 69 3898 132 3641 390 3704 258 3772 321 3134 896 3157 810 3220 553 3478 616 3346 684 2065 1966 2128 1829 2202 1572 2457 1638 2328 1698 2396 1057 2974 1120 2826 1204 2569 1462 2632 1330 2700 1393 14 4016 69 3898 132 3641 390 3704 258 3772 321 3134 4030 64 3888 133 3642 388 3705 262 3768 322...
result:
ok 1
Test #11:
score: 0
Accepted
time: 0ms
memory: 6204kb
input:
89
output:
Yes 0 16129 254 15872 341 15402 852 15529 598 15656 722 14380 1873 14510 1616 14629 1114 15140 1241 14886 1368 12322 3932 12449 3678 12576 3146 13108 3273 12854 3400 12978 2124 14129 2254 13872 2373 13370 2884 13497 2630 13624 2754 8252 8001 8382 7744 8469 7274 8980 7401 8726 7528 8850 6252 10001 63...
result:
ok 1
Test #12:
score: 0
Accepted
time: 2ms
memory: 4400kb
input:
100
output:
Yes 0 16140 241 15886 368 15365 890 15492 633 15622 760 14338 1916 14465 1662 14592 1109 15146 1236 14889 1366 12328 3922 12460 3665 12590 3152 13093 3290 12836 3417 12966 2136 14114 2268 13857 2398 13344 2890 13492 2633 13622 2760 8242 8012 8369 7758 8496 7237 9018 7364 8761 7494 8888 6210 10044 63...
result:
ok 1
Test #13:
score: 0
Accepted
time: 4ms
memory: 5204kb
input:
200
output:
Yes 0 65252 281 64742 536 63714 1564 63969 1054 64224 1290 61684 3593 61942 3080 62194 2060 63217 2318 62704 2565 57594 7684 57849 7174 58104 6146 59132 6401 58622 6656 58709 4266 61012 4521 60502 4776 59474 5804 59729 5294 59984 5541 49242 16036 49497 15526 49752 14498 50780 14753 50270 15008 50506...
result:
ok 1
Test #14:
score: 0
Accepted
time: 7ms
memory: 6408kb
input:
300
output:
Yes 0 65214 320 64661 618 63636 1641 63894 1128 64146 1388 61585 3694 61840 3173 62106 2148 63129 2406 62616 2658 57500 7777 57758 7264 57994 6260 59017 6518 58504 6770 58764 4209 61070 4464 60549 4730 59524 5753 59782 5240 60034 5500 49281 15998 49536 15402 49876 14377 50902 14632 50386 14892 50641...
result:
ok 1
Test #15:
score: 0
Accepted
time: 8ms
memory: 8480kb
input:
400
output:
Yes 0 261170 972 260145 1486 258096 3525 258618 2500 259129 3014 254008 7618 254524 6593 255038 4544 257045 5098 256020 5609 245782 15848 246290 14828 246801 12782 248848 13285 247834 13796 248345 8678 252952 9186 251932 9697 249886 11744 250378 10740 250889 11254 229384 32242 229900 31217 230414 29...
result:
ok 1
Test #16:
score: 0
Accepted
time: 11ms
memory: 9368kb
input:
500
output:
Yes 0 261210 932 260185 1446 258136 3490 258652 2465 259166 2976 254026 7604 254537 6582 255048 4530 257100 5041 256078 5552 245829 15802 246340 14777 246854 12728 248898 13244 247873 13758 248384 8597 253034 9108 252009 9622 249960 11666 250476 10641 250990 11152 229477 32154 229988 31129 230502 29...
result:
ok 1
Test #17:
score: 0
Accepted
time: 26ms
memory: 8576kb
input:
600
output:
Yes 0 261249 894 260224 1322 258260 3369 258774 2344 259282 2860 254161 7470 254672 6437 255194 4388 257241 4902 256216 5410 245980 15649 246494 14624 246986 12596 249033 13110 248008 13618 248524 8497 253134 9008 252101 9530 250052 11577 250566 10552 251074 11068 229569 32062 230080 30997 230634 28...
result:
ok 1
Test #18:
score: 0
Accepted
time: 27ms
memory: 9524kb
input:
700
output:
Yes 0 1047542 1032 1045490 2060 1041393 6158 1042416 4101 1043450 5124 1033209 14342 1034232 12290 1035260 8193 1039358 9216 1036629 10922 1016148 31401 1017174 29352 1018194 25260 1022289 26286 1020240 27301 1021274 17060 1030489 18086 1028440 19106 1024348 23201 1025374 21152 1026378 22196 983369 ...
result:
ok 1
Test #19:
score: 0
Accepted
time: 45ms
memory: 10488kb
input:
800
output:
Yes 0 1047440 1125 1045402 2148 1041305 6246 1042328 4194 1043356 5217 1033118 14432 1034122 12404 1035145 8310 1039240 9330 1037196 10353 1016718 30832 1017733 28794 1018756 24697 1022854 25720 1020802 26748 1021825 16510 1031040 17450 1029076 18473 1024982 22568 1026002 20524 1027025 21550 984016 ...
result:
ok 1
Test #20:
score: 0
Accepted
time: 56ms
memory: 12548kb
input:
900
output:
Yes 0 1047356 1217 1045310 2240 1041173 6378 1042196 4329 1043222 5352 1032978 14572 1034001 12526 1035024 8421 1039130 9444 1037081 10470 1016600 30946 1017628 28897 1018654 24800 1022730 25844 1020681 26870 1021704 16626 1030924 17649 1028878 18672 1024773 22778 1025796 20729 1026822 21752 983810 ...
result:
ok 1
Test #21:
score: 0
Accepted
time: 61ms
memory: 13788kb
input:
1000
output:
Yes 0 1047369 1206 1045320 2226 1041228 6321 1042254 4272 1043269 5306 1033028 14521 1034054 12472 1035074 8380 1039169 9406 1037120 10389 1016682 30868 1017705 28822 1018728 24722 1022828 25745 1020782 26768 1021797 16538 1031012 17561 1028966 18584 1024866 22684 1025889 20638 1026912 21642 983924 ...
result:
ok 1
Test #22:
score: 0
Accepted
time: 99ms
memory: 15056kb
input:
1200
output:
Yes 0 1047288 1282 1045244 2305 1041150 6400 1042005 4522 1043028 5545 1032790 14760 1033810 12716 1034833 8622 1038928 9637 1036890 10660 1016409 31142 1017432 29090 1018460 24993 1022558 26016 1020490 27060 1021513 16822 1030728 17842 1028684 18865 1024590 22960 1025605 20922 1026628 21945 983622 ...
result:
ok 1
Test #23:
score: 0
Accepted
time: 128ms
memory: 16896kb
input:
1400
output:
Yes 0 4190225 4078 4186128 6117 4177946 14308 4179993 10214 4182040 12258 4161564 30689 4163614 26592 4165642 18420 4173833 20470 4169736 22514 4128780 63473 4130830 59376 4132869 51194 4141060 53241 4136966 55288 4139010 34812 4157441 36862 4153344 38229 4145834 46420 4147881 42326 4149928 44370 40...
result:
ok 1
Test #24:
score: 0
Accepted
time: 172ms
memory: 18312kb
input:
1600
output:
Yes 0 4190410 3892 4186313 5942 4178120 14130 4180172 10033 4182222 12080 4161733 30522 4163780 26425 4165830 18232 4174018 20284 4169921 22334 4128960 63253 4131050 59156 4133097 50966 4141288 53010 4137196 55057 4139246 34576 4157669 36634 4153572 38681 4145382 46872 4147426 42780 4149473 44830 40...
result:
ok 1
Test #25:
score: 0
Accepted
time: 209ms
memory: 18380kb
input:
1800
output:
Yes 0 4190596 3705 4186502 5752 4178306 13948 4180353 9854 4182400 11818 4162004 30249 4164054 26152 4166098 17964 4174289 20014 4170192 22053 4129242 63012 4131289 58918 4133336 50722 4141532 52769 4137438 54816 4139466 34356 4157897 36406 4153800 38450 4145612 46641 4147662 42544 4149701 44602 406...
result:
ok 1
Test #26:
score: 0
Accepted
time: 243ms
memory: 18876kb
input:
1900
output:
Yes 0 4190494 3808 4186378 5876 4178185 14070 4180232 9970 4182284 12017 4161806 30448 4163845 26362 4165892 18169 4174086 20216 4169986 22268 4129025 63230 4131072 58965 4133290 50772 4141481 52822 4137384 54866 4139436 34385 4157870 36432 4153765 38490 4145572 46681 4147622 42584 4149666 44636 406...
result:
ok 1
Test #27:
score: 0
Accepted
time: 248ms
memory: 19064kb
input:
1920
output:
Yes 0 4190485 3818 4186388 5865 4178198 14056 4180242 9964 4182289 12014 4161808 30437 4163866 26340 4165913 18150 4174104 20194 4170012 22241 4129054 63200 4131082 59124 4133129 50934 4141320 52978 4137228 55025 4139278 34544 4157701 36602 4153604 38649 4145414 46840 4147458 42748 4149505 44798 406...
result:
ok 1
Test #28:
score: 0
Accepted
time: 266ms
memory: 19604kb
input:
2000
output:
Yes 0 4190568 3730 4186476 5777 4178286 13968 4180325 9882 4182372 11929 4161894 30360 4163938 26268 4165985 18078 4174176 20106 4170100 22153 4129142 63112 4131186 59020 4133233 50830 4141424 52869 4137338 54916 4139385 34438 4157816 36482 4153724 38529 4145534 46720 4147498 42708 4149545 44758 406...
result:
ok 1
Test #29:
score: 0
Accepted
time: 1ms
memory: 4220kb
input:
62
output:
Yes 0 4020 73 3894 136 3634 396 3697 270 3760 325 3130 900 3193 774 3256 514 3516 577 3390 640 2069 1962 2132 1833 2198 1576 2450 1644 2321 1710 2384 1061 2970 1124 2841 1190 2584 1442 2652 1313 2718 1376 10 4020 73 3894 136 3634 396 3697 270 3760 325 3130 900 3193 774 3256 514 3516 577 4030 64 3892...
result:
ok 1
Test #30:
score: 0
Accepted
time: 3ms
memory: 6784kb
input:
130
output:
Yes 0 16190 192 15893 362 15380 873 15510 616 15634 748 14353 1902 14480 1637 14618 1124 15129 1254 14872 1378 12316 3937 12446 3680 12554 3188 13065 3318 12808 3442 12940 2161 14094 2288 13829 2426 13316 2937 13446 2680 13570 2812 8193 8062 8320 7765 8490 7252 9001 7382 8744 7506 8876 6225 10030 63...
result:
ok 1
Test #31:
score: 0
Accepted
time: 0ms
memory: 4804kb
input:
126
output:
Yes 0 16148 233 15894 360 15378 876 15505 622 15632 741 14362 1892 14489 1638 14616 1122 15132 1249 14878 1376 12298 3956 12425 3702 12552 3186 13068 3313 12814 3440 12933 2170 14084 2297 13830 2424 13314 2940 13441 2686 13568 2773 8234 8020 8361 7766 8488 7250 9004 7377 8750 7504 8869 6234 10020 63...
result:
ok 1
Test #32:
score: 0
Accepted
time: 1ms
memory: 4256kb
input:
66
output:
Yes 0 4001 94 3872 138 3636 393 3702 264 3762 332 3121 910 3184 773 3258 516 3513 582 3384 642 2108 1921 2174 1792 2197 1578 2452 1641 2326 1704 2386 1068 2961 1134 2832 1189 2586 1444 2649 1318 2712 1378 28 4001 94 3872 138 3636 393 3702 264 3762 332 3121 910 3184 773 3258 516 3513 582 3384 642 210...
result:
ok 1
Test #33:
score: 0
Accepted
time: 68ms
memory: 13860kb
input:
1021
output:
Yes 0 1047382 1192 1045330 2220 1041233 6318 1042256 4261 1043290 5284 1033049 14502 1034072 12450 1035100 8353 1039198 9376 1037130 10420 1016649 30902 1017672 28850 1018700 24753 1022798 25776 1020741 26810 1021764 16569 1030982 17592 1028930 18620 1024833 22718 1025856 20629 1026922 21652 983913 ...
result:
ok 1
Test #34:
score: 0
Accepted
time: 68ms
memory: 13504kb
input:
1022
output:
Yes 0 1047380 1193 1045334 2216 1041234 6316 1042257 4270 1043280 5285 1033050 14500 1034073 12454 1035096 8354 1039196 9377 1037150 10400 1016650 30900 1017673 28854 1018696 24754 1022796 25777 1020750 26800 1021765 16570 1030980 17593 1028934 18616 1024834 22716 1025857 20670 1026880 21653 983914 ...
result:
ok 1
Test #35:
score: 0
Accepted
time: 68ms
memory: 13608kb
input:
1023
output:
Yes 0 1047380 1193 1045334 2216 1041234 6316 1042257 4270 1043280 5285 1033050 14500 1034073 12454 1035096 8354 1039196 9377 1037150 10400 1016650 30900 1017673 28854 1018696 24754 1022796 25777 1020750 26800 1021765 16570 1030980 17593 1028934 18616 1024834 22716 1025857 20670 1026880 21653 983914 ...
result:
ok 1
Test #36:
score: 0
Accepted
time: 49ms
memory: 12768kb
input:
1024
output:
Yes 0 1047040 1194 1045332 2217 1041238 6312 1042258 4268 1043281 5294 1033040 14501 1034074 12452 1035097 8358 1039192 9378 1037148 10401 1016670 30880 1017674 28852 1018697 24758 1022792 25778 1020748 26801 1021774 16560 1030981 17594 1028932 18617 1024838 22712 1025858 20668 1026881 21694 983872 ...
result:
ok 1
Test #37:
score: 0
Accepted
time: 70ms
memory: 15636kb
input:
1025
output:
Yes 0 1047040 1194 1045332 2217 1041238 6312 1042258 4268 1043281 5294 1033040 14501 1034074 12452 1035097 8358 1039192 9378 1037148 10401 1016670 30880 1017674 28852 1018697 24758 1022792 25778 1020748 26801 1021774 16560 1030981 17594 1028932 18617 1024838 22712 1025858 20668 1026881 21694 983872 ...
result:
ok 1
Test #38:
score: 0
Accepted
time: 68ms
memory: 12936kb
input:
1026
output:
Yes 0 1047041 1534 1044992 2218 1041236 6313 1042262 4264 1043282 5292 1033041 14510 1034064 12453 1035098 8356 1039193 9382 1037144 10402 1016668 30881 1017694 28832 1018698 24756 1022793 25782 1020744 26802 1021772 16561 1030990 17584 1028933 18618 1024836 22713 1025862 20664 1026882 21692 983873 ...
result:
ok 1
Test #39:
score: 0
Accepted
time: 69ms
memory: 12240kb
input:
1027
output:
Yes 0 1047041 1534 1044992 2218 1041236 6313 1042262 4264 1043282 5292 1033041 14510 1034064 12453 1035098 8356 1039193 9382 1037144 10402 1016668 30881 1017694 28832 1018698 24756 1022793 25782 1020744 26802 1021772 16561 1030990 17584 1028933 18618 1024836 22713 1025862 20664 1026882 21692 983873 ...
result:
ok 1
Extra Test:
score: 0
Extra Test Passed