QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#267744 | #7868. 天空度假山庄 | xyz123 | 25 | 61ms | 32324kb | C++14 | 2.0kb | 2023-11-27 17:51:42 | 2023-11-27 17:51:43 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const long long mod=1e9+7;
long long T,a,b,c,d[1000001],v[1001][1001],o,h[1000001],fa[1000001],q,w,e,an,cn,fac[1000001],inv[1000001],st[1000001],u[1000001],vi[1000001];
char s[1000001];
struct p{long long q,w;}l[1000001];
long long pow_(long long qq,long long ww){long long ee=1;while(ww){if(ww&1) ee*=qq,ee%=mod;qq*=qq,qq%=mod,ww>>=1;}return ee%mod;}
inline int read(){int x=0,f=1;char c=getchar();while(c<'0'||c>'9'){if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9'){x=(x<<3)+(x<<1)+c-'0';c=getchar();}return x*f;}
void add(long long qq,long long ww){l[++o].q=ww,l[o].w=h[qq],h[qq]=o;}
long long gcd(long long qq,long long ww){return !ww?qq:gcd(ww,qq%ww);}
long long find(long long qq){return qq==fa[qq]?qq:fa[qq]=find(fa[qq]);}
void merge(long long qq,long long ww){long long f1=find(qq),f2=find(ww);if(f1==f2) return;fa[f1]=f2;}
long long C(long long qq,long long ww){return fac[qq]*inv[ww]%mod*inv[qq-ww]%mod;}
int main()
{
// freopen("1.in","r",stdin);
srand((unsigned)(time(0)^(*new int)));
fac[0]=1;for(int i=1;i<=1000000;i++) fac[i]=fac[i-1]*i%mod;
inv[1000000]=pow_(fac[1000000],mod-2);for(int i=999999;i>=0;i--) inv[i]=inv[i+1]*(i+1)%mod;
scanf("%lld%lld",&a,&b);
vi[0]=1;
long long tt=0,gg=(b+1)/2;
// st[++cn]=0;
while(1)
{
long long hh=tt;
vi[hh]=1;
if(vi[(hh+gg)%a])
{
if(vi[(hh+gg+1)%a]) break;
for(int j=b+1;j>=2;j--)
{
if(b%2==0&&j==2) --j;
if((b+1-j)%2==0) hh+=j;
else hh-=j;
hh=(hh%a+a)%a;
st[++cn]=hh;
}
}
else
{
for(int j=b;j>=1;j--)
{
if((b-j)%2==0) hh+=j;
else hh-=j;
hh=(hh%a+a)%a;
st[++cn]=hh;
}
}
tt=hh;
}
// for(int i=1;i<cn;i++) v[st[i]+1][st[i+1]+1]=v[st[i+1]+1][st[i]+1]++;
// bool fll=0;
// for(int i=1;i<=a;i++)
// {
// for(int j=i+1;j<=a;j++)
// {
// if(v[i][j]>1)
// {
// cout<<i<<" "<<j<<"\n";fll=1;break;
// }
// }
// if(fll) break;
// }
for(int i=1;i<=cn;i++) printf("%lld ",st[i]+1);
return 0;
}
詳細信息
Subtask #1:
score: 5
Accepted
Test #1:
score: 5
Accepted
time: 13ms
memory: 24284kb
input:
8216 1
output:
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 10...
result:
ok correct
Test #2:
score: 0
Accepted
time: 13ms
memory: 26372kb
input:
5166 2
output:
3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50 52 51 53 52 54 53 55 ...
result:
ok correct
Test #3:
score: 0
Accepted
time: 4ms
memory: 26156kb
input:
7445 2
output:
3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50 52 51 53 52 54 53 55 ...
result:
ok correct
Test #4:
score: 0
Accepted
time: 8ms
memory: 26372kb
input:
1295 2
output:
3 2 4 3 5 4 6 5 7 6 8 7 9 8 10 9 11 10 12 11 13 12 14 13 15 14 16 15 17 16 18 17 19 18 20 19 21 20 22 21 23 22 24 23 25 24 26 25 27 26 28 27 29 28 30 29 31 30 32 31 33 32 34 33 35 34 36 35 37 36 38 37 39 38 40 39 41 40 42 41 43 42 44 43 45 44 46 45 47 46 48 47 49 48 50 49 51 50 52 51 53 52 54 53 55 ...
result:
ok correct
Subtask #2:
score: 20
Accepted
Test #5:
score: 20
Accepted
time: 50ms
memory: 32324kb
input:
86132 9
output:
10 2 9 3 8 4 7 5 6 15 7 14 8 13 9 12 10 11 20 12 19 13 18 14 17 15 16 25 17 24 18 23 19 22 20 21 30 22 29 23 28 24 27 25 26 35 27 34 28 33 29 32 30 31 40 32 39 33 38 34 37 35 36 45 37 44 38 43 39 42 40 41 50 42 49 43 48 44 47 45 46 55 47 54 48 53 49 52 50 51 60 52 59 53 58 54 57 55 56 65 57 64 58 63...
result:
ok correct
Test #6:
score: 0
Accepted
time: 34ms
memory: 32292kb
input:
73452 11
output:
12 2 11 3 10 4 9 5 8 6 7 18 8 17 9 16 10 15 11 14 12 13 24 14 23 15 22 16 21 17 20 18 19 30 20 29 21 28 22 27 23 26 24 25 36 26 35 27 34 28 33 29 32 30 31 42 32 41 33 40 34 39 35 38 36 37 48 38 47 39 46 40 45 41 44 42 43 54 44 53 45 52 46 51 47 50 48 49 60 50 59 51 58 52 57 53 56 54 55 66 56 65 57 6...
result:
ok correct
Test #7:
score: 0
Accepted
time: 36ms
memory: 28416kb
input:
23283 20
output:
21 2 20 3 19 4 18 5 17 6 16 7 15 8 14 9 13 10 12 11 31 12 30 13 29 14 28 15 27 16 26 17 25 18 24 19 23 20 22 21 41 22 40 23 39 24 38 25 37 26 36 27 35 28 34 29 33 30 32 31 51 32 50 33 49 34 48 35 47 36 46 37 45 38 44 39 43 40 42 41 61 42 60 43 59 44 58 45 57 46 56 47 55 48 54 49 53 50 52 51 71 52 70...
result:
ok correct
Test #8:
score: 0
Accepted
time: 42ms
memory: 32320kb
input:
36944 17
output:
18 2 17 3 16 4 15 5 14 6 13 7 12 8 11 9 10 27 11 26 12 25 13 24 14 23 15 22 16 21 17 20 18 19 36 20 35 21 34 22 33 23 32 24 31 25 30 26 29 27 28 45 29 44 30 43 31 42 32 41 33 40 34 39 35 38 36 37 54 38 53 39 52 40 51 41 50 42 49 43 48 44 47 45 46 63 47 62 48 61 49 60 50 59 51 58 52 57 53 56 54 55 72...
result:
ok correct
Test #9:
score: 0
Accepted
time: 42ms
memory: 30632kb
input:
61927 10
output:
11 2 10 3 9 4 8 5 7 6 16 7 15 8 14 9 13 10 12 11 21 12 20 13 19 14 18 15 17 16 26 17 25 18 24 19 23 20 22 21 31 22 30 23 29 24 28 25 27 26 36 27 35 28 34 29 33 30 32 31 41 32 40 33 39 34 38 35 37 36 46 37 45 38 44 39 43 40 42 41 51 42 50 43 49 44 48 45 47 46 56 47 55 48 54 49 53 50 52 51 61 52 60 53...
result:
ok correct
Subtask #3:
score: 0
Wrong Answer
Dependency #2:
100%
Accepted
Test #10:
score: 20
Accepted
time: 9ms
memory: 26384kb
input:
111 17
output:
18 2 17 3 16 4 15 5 14 6 13 7 12 8 11 9 10 27 11 26 12 25 13 24 14 23 15 22 16 21 17 20 18 19 36 20 35 21 34 22 33 23 32 24 31 25 30 26 29 27 28 45 29 44 30 43 31 42 32 41 33 40 34 39 35 38 36 37 54 38 53 39 52 40 51 41 50 42 49 43 48 44 47 45 46 63 47 62 48 61 49 60 50 59 51 58 52 57 53 56 54 55 72...
result:
ok correct
Test #11:
score: 0
Accepted
time: 7ms
memory: 26384kb
input:
462 86
output:
87 2 86 3 85 4 84 5 83 6 82 7 81 8 80 9 79 10 78 11 77 12 76 13 75 14 74 15 73 16 72 17 71 18 70 19 69 20 68 21 67 22 66 23 65 24 64 25 63 26 62 27 61 28 60 29 59 30 58 31 57 32 56 33 55 34 54 35 53 36 52 37 51 38 50 39 49 40 48 41 47 42 46 43 45 44 130 45 129 46 128 47 127 48 126 49 125 50 124 51 1...
result:
ok correct
Test #12:
score: 0
Accepted
time: 13ms
memory: 26152kb
input:
262 43
output:
44 2 43 3 42 4 41 5 40 6 39 7 38 8 37 9 36 10 35 11 34 12 33 13 32 14 31 15 30 16 29 17 28 18 27 19 26 20 25 21 24 22 23 66 24 65 25 64 26 63 27 62 28 61 29 60 30 59 31 58 32 57 33 56 34 55 35 54 36 53 37 52 38 51 39 50 40 49 41 48 42 47 43 46 44 45 88 46 87 47 86 48 85 49 84 50 83 51 82 52 81 53 80...
result:
ok correct
Test #13:
score: 0
Accepted
time: 12ms
memory: 24348kb
input:
672 125
output:
126 2 125 3 124 4 123 5 122 6 121 7 120 8 119 9 118 10 117 11 116 12 115 13 114 14 113 15 112 16 111 17 110 18 109 19 108 20 107 21 106 22 105 23 104 24 103 25 102 26 101 27 100 28 99 29 98 30 97 31 96 32 95 33 94 34 93 35 92 36 91 37 90 38 89 39 88 40 87 41 86 42 85 43 84 44 83 45 82 46 81 47 80 48...
result:
ok correct
Test #14:
score: 0
Accepted
time: 11ms
memory: 28196kb
input:
747 127
output:
128 2 127 3 126 4 125 5 124 6 123 7 122 8 121 9 120 10 119 11 118 12 117 13 116 14 115 15 114 16 113 17 112 18 111 19 110 20 109 21 108 22 107 23 106 24 105 25 104 26 103 27 102 28 101 29 100 30 99 31 98 32 97 33 96 34 95 35 94 36 93 37 92 38 91 39 90 40 89 41 88 42 87 43 86 44 85 45 84 46 83 47 82 ...
result:
ok correct
Test #15:
score: -20
Wrong Answer
time: 14ms
memory: 26180kb
input:
404 72
output:
73 2 72 3 71 4 70 5 69 6 68 7 67 8 66 9 65 10 64 11 63 12 62 13 61 14 60 15 59 16 58 17 57 18 56 19 55 20 54 21 53 22 52 23 51 24 50 25 49 26 48 27 47 28 46 29 45 30 44 31 43 32 42 33 41 34 40 35 39 36 38 37 109 38 108 39 107 40 106 41 105 42 104 43 103 44 102 45 101 46 100 47 99 48 98 49 97 50 96 5...
result:
wrong output format Unexpected end of file - int32 expected
Subtask #4:
score: 0
Runtime Error
Test #16:
score: 20
Accepted
time: 36ms
memory: 30188kb
input:
1777 229
output:
230 2 229 3 228 4 227 5 226 6 225 7 224 8 223 9 222 10 221 11 220 12 219 13 218 14 217 15 216 16 215 17 214 18 213 19 212 20 211 21 210 22 209 23 208 24 207 25 206 26 205 27 204 28 203 29 202 30 201 31 200 32 199 33 198 34 197 35 196 36 195 37 194 38 193 39 192 40 191 41 190 42 189 43 188 44 187 45 ...
result:
ok correct
Test #17:
score: 0
Accepted
time: 23ms
memory: 28272kb
input:
1129 229
output:
230 2 229 3 228 4 227 5 226 6 225 7 224 8 223 9 222 10 221 11 220 12 219 13 218 14 217 15 216 16 215 17 214 18 213 19 212 20 211 21 210 22 209 23 208 24 207 25 206 26 205 27 204 28 203 29 202 30 201 31 200 32 199 33 198 34 197 35 196 36 195 37 194 38 193 39 192 40 191 41 190 42 189 43 188 44 187 45 ...
result:
ok correct
Test #18:
score: 0
Accepted
time: 61ms
memory: 30236kb
input:
4253 233
output:
234 2 233 3 232 4 231 5 230 6 229 7 228 8 227 9 226 10 225 11 224 12 223 13 222 14 221 15 220 16 219 17 218 18 217 19 216 20 215 21 214 22 213 23 212 24 211 25 210 26 209 27 208 28 207 29 206 30 205 31 204 32 203 33 202 34 201 35 200 36 199 37 198 38 197 39 196 40 195 41 194 42 193 43 192 44 191 45 ...
result:
ok correct
Test #19:
score: 0
Accepted
time: 27ms
memory: 30248kb
input:
2311 233
output:
234 2 233 3 232 4 231 5 230 6 229 7 228 8 227 9 226 10 225 11 224 12 223 13 222 14 221 15 220 16 219 17 218 18 217 19 216 20 215 21 214 22 213 23 212 24 211 25 210 26 209 27 208 28 207 29 206 30 205 31 204 32 203 33 202 34 201 35 200 36 199 37 198 38 197 39 196 40 195 41 194 42 193 43 192 44 191 45 ...
result:
ok correct
Test #20:
score: 0
Accepted
time: 54ms
memory: 30248kb
input:
6712 114
output:
115 2 114 3 113 4 112 5 111 6 110 7 109 8 108 9 107 10 106 11 105 12 104 13 103 14 102 15 101 16 100 17 99 18 98 19 97 20 96 21 95 22 94 23 93 24 92 25 91 26 90 27 89 28 88 29 87 30 86 31 85 32 84 33 83 34 82 35 81 36 80 37 79 38 78 39 77 40 76 41 75 42 74 43 73 44 72 45 71 46 70 47 69 48 68 49 67 5...
result:
ok correct
Test #21:
score: -20
Runtime Error
input:
1050 114
output:
result:
Subtask #5:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #3:
0%