QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#283003 | #6652. 着色 | one_god_and_two_dogs# | WA | 20ms | 7684kb | C++14 | 955b | 2023-12-13 17:35:37 | 2023-12-13 17:35:38 |
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(vector <int> A,int n){
if(n<=1)return ;
for(int i=0;i<n;i++)op[A[i]]=i%5;
// for(int i=0;i<n;i++){
// printf("A=%d,op=%d\n",A[i],op[A[i]]);
// }
// puts("");
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(op[A[i]]!=op[A[j]])res[A[i]][A[j]]=ans[op[A[i]]][op[A[j]]];
}
}
for(int j=0;j<=4;j++){
vector <int> B;
for(int i=j;i<n;i+=5)B.push_back(A[i]);
solve(B,B.size());
B.clear();
}
}
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;
vector <int> A;
for(int i=1;i<=n;i++)A.push_back(i);
solve(A,n);
for(int i=1;i<=n;i++){
for(int j=i+1;j<=n;j++)printf("%d",res[i][j]);
puts("");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3744kb
input:
2
output:
0
result:
ok Accepted.
Test #2:
score: -100
Wrong Answer
time: 20ms
memory: 7684kb
input:
1000
output:
012300123101232012330123001230012310123201233012310123001231012320123301232012300123101232012330123301230012310123201233012300123001231012320123301230012300123101232012330123101230012310123201233012320123001231012320123301233012300123101232012330123101230012310123201233012300123001231012320123301231...
result:
FAIL There is a 3-cycle with the same color.