QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#283059 | #6652. 着色 | one_god_and_two_dogs# | WA | 19ms | 7736kb | C++14 | 821b | 2023-12-13 18:46:48 | 2023-12-13 18:46:49 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int M=1005;
int op[M];
int res[M][M],ans[15][15];
void solve(int l,int r){
if(r-l+1<=5){
for(int i=l;i<r;i++){
for(int j=i+1;j<=r;j++)res[i][j]=ans[i-l][j-l];
}
return ;
}
int mid=l+r>>1;
solve(l,mid),solve(mid+1,r);
int O=0;
for(int i=mid+1;i<=r;i++){
int op=0;
for(int j=l;j<=mid;j++){
while(O==op)op=(op+1)%5;
res[j][i]=ans[O][op];
op=(op+1)%5;
}
}
}
int main() {
int cnt=0;
for(int i=0;i<=4;i++)for(int j=i+1;j<=4;j++)ans[i][j]=ans[j][i]=cnt++;
int n;cin>>n;
solve(1,n);
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++)printf("%d",res[i][j]);
puts("");
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3768kb
input:
2
output:
0
result:
ok Accepted.
Test #2:
score: -100
Wrong Answer
time: 19ms
memory: 7736kb
input:
1000
output:
012000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
FAIL There is a 3-cycle with the same color.