QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#114709#5095. 九王唱275307894a0 1ms5800kbC++141.3kb2023-06-23 07:18:042023-06-23 07:18:05

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-23 07:18:05]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:5800kb
  • [2023-06-23 07:18:04]
  • 提交

answer

#include<bits/stdc++.h>
#define Gc() getchar() 
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using LL=__int128;
using namespace std;const int N=5000+5,M=(1<<15)+5,K=(1<<20)+5,mod=1e9+7,Mod=mod-1;const db eps=1e-9;const ll INF=1e18+7;mt19937 rnd(time(0));
int n,seed,A[N*2][N],vis[N*2][2],p[N],tg[N];
void gen(int n,int seed){
    std::mt19937 rnd(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][rnd()%j+1]);
        }
    }
}
int main(){
	int i,j,h;scanf("%d%d",&n,&seed);
	if(!seed) for(i=1;i<=n;i++) for(j=1;j<=n+1;j++) scanf("%d",&A[i][j]);
	else gen(n,seed);
	for(i=n+1;i<=2*n;i++) for(j=1;j<=n+1;j++) A[i][j]=A[i-n][j];
	for(i=2*n;i;i--){
		fill(vis[i]+1,vis[i]+n+2,1);
		for(j=1;j<=n+1;j++) p[A[i][j]]=j;
		int R=i;
		for(j=1;j<=n+1;j++) {
			while(R<=2*n&&R<i+n&&A[R][p[j]]) A[R][p[j]]=0;R++;
		}
	}
	for(i=1;i<=n+1;i++) if(A[2*n][i]) printf("%d ",i);
	for(i=n+1;i<2*n;i++) for(j=1;j<=n+1;j++) if(A[i][j]) printf("%d ",j);
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

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
Wrong Answer
time: 1ms
memory: 3820kb

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:

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

result:

wrong answer 1st numbers differ - expected: '7', found: '5'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%