QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#263785 | #7868. 天空度假山庄 | zhouhuanyi | 5 | 42ms | 3892kb | C++14 | 628b | 2023-11-25 07:29:23 | 2023-11-25 07:29:23 |
Judging History
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 (max(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: 0ms
memory: 3844kb
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: 3892kb
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: 1ms
memory: 3832kb
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: 3892kb
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: 0
Wrong Answer
Test #5:
score: 20
Accepted
time: 34ms
memory: 3828kb
input:
86132 9
output:
2 86132 3 86131 4 86130 5 86129 86128 86129 86127 86130 86126 86131 86125 86132 86124 86123 86124 86122 86125 86121 86126 86120 86127 86119 86118 86119 86117 86120 86116 86121 86115 86122 86114 86113 86114 86112 86115 86111 86116 86110 86117 86109 86108 86109 86107 86110 86106 86111 86105 86112 8610...
result:
ok correct
Test #6:
score: -20
Wrong Answer
time: 42ms
memory: 3832kb
input:
73452 11
output:
2 73452 3 73451 4 73450 5 73449 6 73448 73446 73447 73445 73448 73444 73449 73443 73450 73442 73451 73441 73439 73440 73438 73441 73437 73442 73436 73443 73435 73444 73434 73432 73433 73431 73434 73430 73435 73429 73436 73428 73437 73427 73425 73426 73424 73427 73423 73428 73422 73429 73421 73430 73...
result:
wrong answer visit same point several times.
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Wrong Answer
Test #16:
score: 20
Accepted
time: 18ms
memory: 3760kb
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: 12ms
memory: 3824kb
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: 40ms
memory: 3828kb
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: 24ms
memory: 3792kb
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: -20
Wrong Answer
time: 34ms
memory: 3812kb
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:
wrong answer visit same point several times.
Subtask #5:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #3:
0%