QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#267742 | #7868. 天空度假山庄 | xyz123 | 0 | 32ms | 39776kb | C++14 | 2.0kb | 2023-11-27 17:50:53 | 2023-11-27 17:50:54 |
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: 0
Runtime Error
Test #1:
score: 0
Runtime Error
input:
8216 1
output:
result:
Subtask #2:
score: 0
Runtime Error
Test #5:
score: 0
Runtime Error
input:
86132 9
output:
result:
Subtask #3:
score: 0
Skipped
Dependency #2:
0%
Subtask #4:
score: 0
Wrong Answer
Test #16:
score: 20
Accepted
time: 32ms
memory: 39776kb
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: -20
Wrong Answer
time: 28ms
memory: 36700kb
input:
1129 229
output:
1 1005 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 ...
result:
wrong output format Extra information in the output file
Subtask #5:
score: 0
Skipped
Dependency #1:
0%