QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#263786#7868. 天空度假山庄zhouhuanyi100 ✓39ms3796kbC++14628b2023-11-25 07:29:452023-11-25 07:29:46

Judging History

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

  • [2023-11-25 07:29:46]
  • 评测
  • 测评结果:100
  • 用时:39ms
  • 内存:3796kb
  • [2023-11-25 07:29:45]
  • 提交

answer

#include<iostream>
#include<cstdio>
#define N 1000000
using namespace std;
int read()
{
	char c=0;
	int sum=0;
	while (c<'0'||c>'9') c=getchar();
	while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
	return sum;
}
int n,k;
int gcd(int x,int y)
{
	if (!y) return x;
	return gcd(y,x%y);
}
int main()
{
	int x=0,a,d,ds=0;
	n=read(),k=read();
	if (k&1) a=-(k>>1);
	else a=k>>1;
	for (int i=1;i<=n-1;++i)
		if (min(i,n-i)>=k&&gcd(i+a,n)==1)
			ds=i;
	for (int i=1;i<=k*(n-1);++i)
	{
		d=i%k;
		if (d) x=(d&1)?(x+d)%n:(x+n-d)%n;
		else x=(x+ds)%n;
		printf("%d ",x+1);
	}
	puts("");
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms
memory: 3564kb

input:

8216 1

output:

8216 8215 8214 8213 8212 8211 8210 8209 8208 8207 8206 8205 8204 8203 8202 8201 8200 8199 8198 8197 8196 8195 8194 8193 8192 8191 8190 8189 8188 8187 8186 8185 8184 8183 8182 8181 8180 8179 8178 8177 8176 8175 8174 8173 8172 8171 8170 8169 8168 8167 8166 8165 8164 8163 8162 8161 8160 8159 8158 8157 ...

result:

ok correct

Test #2:

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

input:

5166 2

output:

2 5166 1 5165 5166 5164 5165 5163 5164 5162 5163 5161 5162 5160 5161 5159 5160 5158 5159 5157 5158 5156 5157 5155 5156 5154 5155 5153 5154 5152 5153 5151 5152 5150 5151 5149 5150 5148 5149 5147 5148 5146 5147 5145 5146 5144 5145 5143 5144 5142 5143 5141 5142 5140 5141 5139 5140 5138 5139 5137 5138 5...

result:

ok correct

Test #3:

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

input:

7445 2

output:

2 7445 1 7444 7445 7443 7444 7442 7443 7441 7442 7440 7441 7439 7440 7438 7439 7437 7438 7436 7437 7435 7436 7434 7435 7433 7434 7432 7433 7431 7432 7430 7431 7429 7430 7428 7429 7427 7428 7426 7427 7425 7426 7424 7425 7423 7424 7422 7423 7421 7422 7420 7421 7419 7420 7418 7419 7417 7418 7416 7417 7...

result:

ok correct

Test #4:

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

input:

1295 2

output:

2 1295 1 1294 1295 1293 1294 1292 1293 1291 1292 1290 1291 1289 1290 1288 1289 1287 1288 1286 1287 1285 1286 1284 1285 1283 1284 1282 1283 1281 1282 1280 1281 1279 1280 1278 1279 1277 1278 1276 1277 1275 1276 1274 1275 1273 1274 1272 1273 1271 1272 1270 1271 1269 1270 1268 1269 1267 1268 1266 1267 1...

result:

ok correct

Subtask #2:

score: 20
Accepted

Test #5:

score: 20
Accepted
time: 39ms
memory: 3684kb

input:

86132 9

output:

2 86132 3 86131 4 86130 5 86129 86120 86121 86119 86122 86118 86123 86117 86124 86116 86107 86108 86106 86109 86105 86110 86104 86111 86103 86094 86095 86093 86096 86092 86097 86091 86098 86090 86081 86082 86080 86083 86079 86084 86078 86085 86077 86068 86069 86067 86070 86066 86071 86065 86072 8606...

result:

ok correct

Test #6:

score: 0
Accepted
time: 38ms
memory: 3560kb

input:

73452 11

output:

2 73452 3 73451 4 73450 5 73449 6 73448 73436 73437 73435 73438 73434 73439 73433 73440 73432 73441 73431 73419 73420 73418 73421 73417 73422 73416 73423 73415 73424 73414 73402 73403 73401 73404 73400 73405 73399 73406 73398 73407 73397 73385 73386 73384 73387 73383 73388 73382 73389 73381 73390 73...

result:

ok correct

Test #7:

score: 0
Accepted
time: 20ms
memory: 3736kb

input:

23283 20

output:

2 23283 3 23282 4 23281 5 23280 6 23279 7 23278 8 23277 9 23276 10 23275 11 23274 23275 23273 23276 23272 23277 23271 23278 23270 23279 23269 23280 23268 23281 23267 23282 23266 23283 23265 1 23264 23265 23263 23266 23262 23267 23261 23268 23260 23269 23259 23270 23258 23271 23257 23272 23256 23273 ...

result:

ok correct

Test #8:

score: 0
Accepted
time: 32ms
memory: 3564kb

input:

36944 17

output:

2 36944 3 36943 4 36942 5 36941 6 36940 7 36939 8 36938 9 36937 36920 36921 36919 36922 36918 36923 36917 36924 36916 36925 36915 36926 36914 36927 36913 36928 36912 36895 36896 36894 36897 36893 36898 36892 36899 36891 36900 36890 36901 36889 36902 36888 36903 36887 36870 36871 36869 36872 36868 36...

result:

ok correct

Test #9:

score: 0
Accepted
time: 30ms
memory: 3716kb

input:

61927 10

output:

2 61927 3 61926 4 61925 5 61924 6 61923 61924 61922 61925 61921 61926 61920 61927 61919 1 61918 61919 61917 61920 61916 61921 61915 61922 61914 61923 61913 61914 61912 61915 61911 61916 61910 61917 61909 61918 61908 61909 61907 61910 61906 61911 61905 61912 61904 61913 61903 61904 61902 61905 61901 ...

result:

ok correct

Subtask #3:

score: 20
Accepted

Dependency #2:

100%
Accepted

Test #10:

score: 20
Accepted
time: 1ms
memory: 3744kb

input:

111 17

output:

2 111 3 110 4 109 5 108 6 107 7 106 8 105 9 104 87 88 86 89 85 90 84 91 83 92 82 93 81 94 80 95 79 62 63 61 64 60 65 59 66 58 67 57 68 56 69 55 70 54 37 38 36 39 35 40 34 41 33 42 32 43 31 44 30 45 29 12 13 11 14 10 15 9 16 8 17 7 18 6 19 5 20 4 98 99 97 100 96 101 95 102 94 103 93 104 92 105 91 106...

result:

ok correct

Test #11:

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

input:

462 86

output:

2 462 3 461 4 460 5 459 6 458 7 457 8 456 9 455 10 454 11 453 12 452 13 451 14 450 15 449 16 448 17 447 18 446 19 445 20 444 21 443 22 442 23 441 24 440 25 439 26 438 27 437 28 436 29 435 30 434 31 433 32 432 33 431 34 430 35 429 36 428 37 427 38 426 39 425 40 424 41 423 42 422 43 421 44 420 421 419...

result:

ok correct

Test #12:

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

input:

262 43

output:

2 262 3 261 4 260 5 259 6 258 7 257 8 256 9 255 10 254 11 253 12 252 13 251 14 250 15 249 16 248 17 247 18 246 19 245 20 244 21 243 22 242 198 199 197 200 196 201 195 202 194 203 193 204 192 205 191 206 190 207 189 208 188 209 187 210 186 211 185 212 184 213 183 214 182 215 181 216 180 217 179 218 1...

result:

ok correct

Test #13:

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

input:

672 125

output:

2 672 3 671 4 670 5 669 6 668 7 667 8 666 9 665 10 664 11 663 12 662 13 661 14 660 15 659 16 658 17 657 18 656 19 655 20 654 21 653 22 652 23 651 24 650 25 649 26 648 27 647 28 646 29 645 30 644 31 643 32 642 33 641 34 640 35 639 36 638 37 637 38 636 39 635 40 634 41 633 42 632 43 631 44 630 45 629 ...

result:

ok correct

Test #14:

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

input:

747 127

output:

2 747 3 746 4 745 5 744 6 743 7 742 8 741 9 740 10 739 11 738 12 737 13 736 14 735 15 734 16 733 17 732 18 731 19 730 20 729 21 728 22 727 23 726 24 725 25 724 26 723 27 722 28 721 29 720 30 719 31 718 32 717 33 716 34 715 35 714 36 713 37 712 38 711 39 710 40 709 41 708 42 707 43 706 44 705 45 704 ...

result:

ok correct

Test #15:

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

input:

404 72

output:

2 404 3 403 4 402 5 401 6 400 7 399 8 398 9 397 10 396 11 395 12 394 13 393 14 392 15 391 16 390 17 389 18 388 19 387 20 386 21 385 22 384 23 383 24 382 25 381 26 380 27 379 28 378 29 377 30 376 31 375 32 374 33 373 34 372 35 371 36 370 37 368 369 367 370 366 371 365 372 364 373 363 374 362 375 361 ...

result:

ok correct

Subtask #4:

score: 20
Accepted

Test #16:

score: 20
Accepted
time: 20ms
memory: 3560kb

input:

1777 229

output:

2 1777 3 1776 4 1775 5 1774 6 1773 7 1772 8 1771 9 1770 10 1769 11 1768 12 1767 13 1766 14 1765 15 1764 16 1763 17 1762 18 1761 19 1760 20 1759 21 1758 22 1757 23 1756 24 1755 25 1754 26 1753 27 1752 28 1751 29 1750 30 1749 31 1748 32 1747 33 1746 34 1745 35 1744 36 1743 37 1742 38 1741 39 1740 40 1...

result:

ok correct

Test #17:

score: 0
Accepted
time: 8ms
memory: 3556kb

input:

1129 229

output:

2 1129 3 1128 4 1127 5 1126 6 1125 7 1124 8 1123 9 1122 10 1121 11 1120 12 1119 13 1118 14 1117 15 1116 16 1115 17 1114 18 1113 19 1112 20 1111 21 1110 22 1109 23 1108 24 1107 25 1106 26 1105 27 1104 28 1103 29 1102 30 1101 31 1100 32 1099 33 1098 34 1097 35 1096 36 1095 37 1094 38 1093 39 1092 40 1...

result:

ok correct

Test #18:

score: 0
Accepted
time: 30ms
memory: 3796kb

input:

4253 233

output:

2 4253 3 4252 4 4251 5 4250 6 4249 7 4248 8 4247 9 4246 10 4245 11 4244 12 4243 13 4242 14 4241 15 4240 16 4239 17 4238 18 4237 19 4236 20 4235 21 4234 22 4233 23 4232 24 4231 25 4230 26 4229 27 4228 28 4227 29 4226 30 4225 31 4224 32 4223 33 4222 34 4221 35 4220 36 4219 37 4218 38 4217 39 4216 40 4...

result:

ok correct

Test #19:

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

input:

2311 233

output:

2 2311 3 2310 4 2309 5 2308 6 2307 7 2306 8 2305 9 2304 10 2303 11 2302 12 2301 13 2300 14 2299 15 2298 16 2297 17 2296 18 2295 19 2294 20 2293 21 2292 22 2291 23 2290 24 2289 25 2288 26 2287 27 2286 28 2285 29 2284 30 2283 31 2282 32 2281 33 2280 34 2279 35 2278 36 2277 37 2276 38 2275 39 2274 40 2...

result:

ok correct

Test #20:

score: 0
Accepted
time: 31ms
memory: 3548kb

input:

6712 114

output:

2 6712 3 6711 4 6710 5 6709 6 6708 7 6707 8 6706 9 6705 10 6704 11 6703 12 6702 13 6701 14 6700 15 6699 16 6698 17 6697 18 6696 19 6695 20 6694 21 6693 22 6692 23 6691 24 6690 25 6689 26 6688 27 6687 28 6686 29 6685 30 6684 31 6683 32 6682 33 6681 34 6680 35 6679 36 6678 37 6677 38 6676 39 6675 40 6...

result:

ok correct

Test #21:

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

input:

1050 114

output:

2 1050 3 1049 4 1048 5 1047 6 1046 7 1045 8 1044 9 1043 10 1042 11 1041 12 1040 13 1039 14 1038 15 1037 16 1036 17 1035 18 1034 19 1033 20 1032 21 1031 22 1030 23 1029 24 1028 25 1027 26 1026 27 1025 28 1024 29 1023 30 1022 31 1021 32 1020 33 1019 34 1018 35 1017 36 1016 37 1015 38 1014 39 1013 40 1...

result:

ok correct

Test #22:

score: 0
Accepted
time: 22ms
memory: 3560kb

input:

1132 514

output:

2 1132 3 1131 4 1130 5 1129 6 1128 7 1127 8 1126 9 1125 10 1124 11 1123 12 1122 13 1121 14 1120 15 1119 16 1118 17 1117 18 1116 19 1115 20 1114 21 1113 22 1112 23 1111 24 1110 25 1109 26 1108 27 1107 28 1106 29 1105 30 1104 31 1103 32 1102 33 1101 34 1100 35 1099 36 1098 37 1097 38 1096 39 1095 40 1...

result:

ok correct

Test #23:

score: 0
Accepted
time: 26ms
memory: 3796kb

input:

1130 514

output:

2 1130 3 1129 4 1128 5 1127 6 1126 7 1125 8 1124 9 1123 10 1122 11 1121 12 1120 13 1119 14 1118 15 1117 16 1116 17 1115 18 1114 19 1113 20 1112 21 1111 22 1110 23 1109 24 1108 25 1107 26 1106 27 1105 28 1104 29 1103 30 1102 31 1101 32 1100 33 1099 34 1098 35 1097 36 1096 37 1095 38 1094 39 1093 40 1...

result:

ok correct

Subtask #5:

score: 35
Accepted

Dependency #1:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #24:

score: 35
Accepted
time: 29ms
memory: 3532kb

input:

1151 564

output:

2 1151 3 1150 4 1149 5 1148 6 1147 7 1146 8 1145 9 1144 10 1143 11 1142 12 1141 13 1140 14 1139 15 1138 16 1137 17 1136 18 1135 19 1134 20 1133 21 1132 22 1131 23 1130 24 1129 25 1128 26 1127 27 1126 28 1125 29 1124 30 1123 31 1122 32 1121 33 1120 34 1119 35 1118 36 1117 37 1116 38 1115 39 1114 40 1...

result:

ok correct

Test #25:

score: 0
Accepted
time: 20ms
memory: 3796kb

input:

1042 511

output:

2 1042 3 1041 4 1040 5 1039 6 1038 7 1037 8 1036 9 1035 10 1034 11 1033 12 1032 13 1031 14 1030 15 1029 16 1028 17 1027 18 1026 19 1025 20 1024 21 1023 22 1022 23 1021 24 1020 25 1019 26 1018 27 1017 28 1016 29 1015 30 1014 31 1013 32 1012 33 1011 34 1010 35 1009 36 1008 37 1007 38 1006 39 1005 40 1...

result:

ok correct

Test #26:

score: 0
Accepted
time: 30ms
memory: 3440kb

input:

1170 575

output:

2 1170 3 1169 4 1168 5 1167 6 1166 7 1165 8 1164 9 1163 10 1162 11 1161 12 1160 13 1159 14 1158 15 1157 16 1156 17 1155 18 1154 19 1153 20 1152 21 1151 22 1150 23 1149 24 1148 25 1147 26 1146 27 1145 28 1144 29 1143 30 1142 31 1141 32 1140 33 1139 34 1138 35 1137 36 1136 37 1135 38 1134 39 1133 40 1...

result:

ok correct

Test #27:

score: 0
Accepted
time: 27ms
memory: 3544kb

input:

1249 615

output:

2 1249 3 1248 4 1247 5 1246 6 1245 7 1244 8 1243 9 1242 10 1241 11 1240 12 1239 13 1238 14 1237 15 1236 16 1235 17 1234 18 1233 19 1232 20 1231 21 1230 22 1229 23 1228 24 1227 25 1226 26 1225 27 1224 28 1223 29 1222 30 1221 31 1220 32 1219 33 1218 34 1217 35 1216 36 1215 37 1214 38 1213 39 1212 40 1...

result:

ok correct

Test #28:

score: 0
Accepted
time: 8ms
memory: 3556kb

input:

746 364

output:

2 746 3 745 4 744 5 743 6 742 7 741 8 740 9 739 10 738 11 737 12 736 13 735 14 734 15 733 16 732 17 731 18 730 19 729 20 728 21 727 22 726 23 725 24 724 25 723 26 722 27 721 28 720 29 719 30 718 31 717 32 716 33 715 34 714 35 713 36 712 37 711 38 710 39 709 40 708 41 707 42 706 43 705 44 704 45 703 ...

result:

ok correct

Test #29:

score: 0
Accepted
time: 29ms
memory: 3796kb

input:

1146 565

output:

2 1146 3 1145 4 1144 5 1143 6 1142 7 1141 8 1140 9 1139 10 1138 11 1137 12 1136 13 1135 14 1134 15 1133 16 1132 17 1131 18 1130 19 1129 20 1128 21 1127 22 1126 23 1125 24 1124 25 1123 26 1122 27 1121 28 1120 29 1119 30 1118 31 1117 32 1116 33 1115 34 1114 35 1113 36 1112 37 1111 38 1110 39 1109 40 1...

result:

ok correct

Test #30:

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

input:

554 265

output:

2 554 3 553 4 552 5 551 6 550 7 549 8 548 9 547 10 546 11 545 12 544 13 543 14 542 15 541 16 540 17 539 18 538 19 537 20 536 21 535 22 534 23 533 24 532 25 531 26 530 27 529 28 528 29 527 30 526 31 525 32 524 33 523 34 522 35 521 36 520 37 519 38 518 39 517 40 516 41 515 42 514 43 513 44 512 45 511 ...

result:

ok correct

Test #31:

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

input:

1061 519

output:

2 1061 3 1060 4 1059 5 1058 6 1057 7 1056 8 1055 9 1054 10 1053 11 1052 12 1051 13 1050 14 1049 15 1048 16 1047 17 1046 18 1045 19 1044 20 1043 21 1042 22 1041 23 1040 24 1039 25 1038 26 1037 27 1036 28 1035 29 1034 30 1033 31 1032 32 1031 33 1030 34 1029 35 1028 36 1027 37 1026 38 1025 39 1024 40 1...

result:

ok correct

Test #32:

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

input:

173 78

output:

2 173 3 172 4 171 5 170 6 169 7 168 8 167 9 166 10 165 11 164 12 163 13 162 14 161 15 160 16 159 17 158 18 157 19 156 20 155 21 154 22 153 23 152 24 151 25 150 26 149 27 148 28 147 29 146 30 145 31 144 32 143 33 142 34 141 35 140 36 139 37 138 38 137 39 136 40 135 136 134 137 133 138 132 139 131 140...

result:

ok correct

Test #33:

score: 0
Accepted
time: 10ms
memory: 3436kb

input:

884 430

output:

2 884 3 883 4 882 5 881 6 880 7 879 8 878 9 877 10 876 11 875 12 874 13 873 14 872 15 871 16 870 17 869 18 868 19 867 20 866 21 865 22 864 23 863 24 862 25 861 26 860 27 859 28 858 29 857 30 856 31 855 32 854 33 853 34 852 35 851 36 850 37 849 38 848 39 847 40 846 41 845 42 844 43 843 44 842 45 841 ...

result:

ok correct

Test #34:

score: 0
Accepted
time: 22ms
memory: 3564kb

input:

1089 537

output:

2 1089 3 1088 4 1087 5 1086 6 1085 7 1084 8 1083 9 1082 10 1081 11 1080 12 1079 13 1078 14 1077 15 1076 16 1075 17 1074 18 1073 19 1072 20 1071 21 1070 22 1069 23 1068 24 1067 25 1066 26 1065 27 1064 28 1063 29 1062 30 1061 31 1060 32 1059 33 1058 34 1057 35 1056 36 1055 37 1054 38 1053 39 1052 40 1...

result:

ok correct

Test #35:

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

input:

433 207

output:

2 433 3 432 4 431 5 430 6 429 7 428 8 427 9 426 10 425 11 424 12 423 13 422 14 421 15 420 16 419 17 418 18 417 19 416 20 415 21 414 22 413 23 412 24 411 25 410 26 409 27 408 28 407 29 406 30 405 31 404 32 403 33 402 34 401 35 400 36 399 37 398 38 397 39 396 40 395 41 394 42 393 43 392 44 391 45 390 ...

result:

ok correct