QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#564856#5095. 九王唱lin19911220 1ms8056kbC++14957b2024-09-15 15:49:392024-09-15 15:49:40

Judging History

你现在查看的是最新测评结果

  • [2024-09-15 15:49:40]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:8056kb
  • [2024-09-15 15:49:39]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=5e3+3;
int a[N][N];
void gen(int n,int seed){
    std::mt19937 rng(seed);
    for(int i=1;i<=n;++i){
        for(int j=1;j<=n+1;++j){
            a[i][j]=j;
            std::swap(a[i][j],a[i][rng()%j+1]);
        }
    }
}
int n,seed;
int b[N][N];
bitset<N>vis;
int main(){
    int u,v,w,x,y,z;
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cin>>n>>seed;
    if(!seed)for(int i=1;i<=n;++i)for(int j=1;j<=n+1;++j)cin>>a[i][j];
    else gen(n,seed);
    for(int i=1;i<=n;++i)
        for(int j=1;j<=n+1;++j)
            b[i][a[i][j]]=j;
    for(int i=1;i<=n;++i){
        for(int i=1;i<=n+1;++i)vis[i]=0;
        for(int j=n;j;--j){
            int k=1;while(vis[b[(i+j-1)%n+1][k]])++k;
            vis[b[(i+j-1)%n+1][k]]=1;
        }
        for(int j=1;j<=n+1;++j)
            if(!vis[j]){printf("%d ",j);break;}
    }
    puts("");
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 8
Accepted
time: 0ms
memory: 5936kb

input:

8 0
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5
6 1 3 2 9 7 8 4 5

output:

5 5 5 5 5 5 5 5 

result:

ok 8 numbers

Test #2:

score: 8
Accepted
time: 1ms
memory: 6012kb

input:

8 0
4 7 8 6 1 3 2 9 5
5 8 9 7 2 4 3 1 6
6 9 1 8 3 5 4 2 7
7 1 2 9 4 6 5 3 8
8 2 3 1 5 7 6 4 9
9 3 4 2 6 8 7 5 1
1 4 5 3 7 9 8 6 2
2 5 6 4 8 1 9 7 3

output:

7 7 7 7 7 7 7 7 

result:

ok 8 numbers

Test #3:

score: 8
Accepted
time: 1ms
memory: 8056kb

input:

8 0
5 2 6 8 7 9 1 3 4
4 1 5 7 6 8 9 2 3
3 9 4 6 5 7 8 1 2
2 8 3 5 4 6 7 9 1
1 7 2 4 3 5 6 8 9
9 6 1 3 2 4 5 7 8
8 5 9 2 1 3 4 6 7
7 4 8 1 9 2 3 5 6

output:

6 6 6 6 6 6 6 6 

result:

ok 8 numbers

Test #4:

score: 8
Accepted
time: 1ms
memory: 5936kb

input:

8 0
2 3 9 1 5 7 6 4 8
2 3 9 1 6 8 7 4 5
2 3 9 1 4 8 6 5 7
2 3 9 1 8 4 5 6 7
2 3 9 1 8 6 7 5 4
2 3 9 1 6 4 7 8 5
2 3 9 1 4 6 5 7 8
2 3 9 1 7 8 5 6 4

output:

3 3 3 3 3 3 3 3 

result:

ok 8 numbers

Test #5:

score: 8
Accepted
time: 0ms
memory: 6012kb

input:

7 0
8 1 5 4 7 6 3 2
8 1 5 7 2 6 4 3
8 1 5 2 7 3 4 6
8 1 5 3 6 7 2 4
8 1 5 4 6 7 2 3
8 1 5 3 7 4 2 6
8 1 5 4 3 2 6 7

output:

1 1 1 1 1 1 1 

result:

ok 7 numbers

Test #6:

score: 0
Wrong Answer
time: 1ms
memory: 5948kb

input:

8 0
2 7 8 1 5 6 3 9 4
9 5 6 1 4 3 8 2 7
4 1 8 3 5 7 2 9 6
6 2 5 8 1 9 7 4 3
4 7 2 5 8 9 1 3 6
3 4 8 2 9 5 7 1 6
7 2 9 1 3 8 5 4 6
5 6 8 3 4 7 9 2 1

output:

3 3 6 3 3 3 3 3 

result:

wrong answer 3rd numbers differ - expected: '3', found: '6'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%