QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#601735 | #5275. Joking? | ship2077# | WA | 0ms | 3960kb | C++23 | 441b | 2024-09-30 11:41:51 | 2024-09-30 11:41:52 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n,num,p[6],ans[6][255];
int main(){
scanf("%d",&n);
iota(p+1,p+n+1,1);
while (1){ ++num;
for (int i=1;i<=n;i++)
ans[i][num]=num*n-n+p[i];
if (!next_permutation(p+1,p+n+1)) break;
}
printf("%d\n",num);
for (int i=1;i<=n;i++)
for (int j=1;j<=num;j++)
printf("%d%c",ans[i][j]," \n"[j==num]);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3960kb
input:
2
output:
2 1 4 2 3
result:
ok n = 2, max_relative_diff = 0.000%
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3872kb
input:
3
output:
6 1 4 8 11 15 18 2 6 7 12 13 17 3 5 9 10 14 16
result:
wrong answer n = 3, max_relative_diff = 33.333%