QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#310474#4996. Icy ItineraryzyxawaWA 4ms20452kbC++23507b2024-01-21 14:37:192024-01-21 14:37:21

Judging History

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

  • [2024-01-21 14:37:21]
  • 评测
  • 测评结果:WA
  • 用时:4ms
  • 内存:20452kb
  • [2024-01-21 14:37:19]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
unordered_map <int,int> G[300001];
int n,m,u,v,lst;
vector <int> dot;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		scanf("%d%d",&u,&v);
		G[u][v]=G[v][u]=1;
	}
	for(int i=1;i<=n;i++){
		for(int j=max(1,lst);j<dot.size();j++){
			if(G[dot[0]][dot[1]]!=G[dot[j]][dot[j-1]]){
				dot.insert(dot.begin()+j-1,i);
				goto again;
			}
		}
		lst=i-1;
		dot.push_back(i);
		again:;
	}
	for(auto i:dot) printf("%d ",i);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 20452kb

input:

4 4
1 2
1 3
1 4
3 4

output:

1 4 2 3 

result:

ok qwq

Test #2:

score: 0
Accepted
time: 4ms
memory: 20420kb

input:

5 0

output:

1 2 3 4 5 

result:

ok qwq

Test #3:

score: -100
Wrong Answer
time: 4ms
memory: 20176kb

input:

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

output:

1 9 10 7 8 4 6 5 2 3 

result:

wrong answer Changed color too many times (5)