QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#438878#4829. Mark on a Graphbors0 0ms0kbC++20846b2024-06-11 10:23:002024-06-11 10:23:01

Judging History

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

  • [2024-06-11 10:23:01]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:0kb
  • [2024-06-11 10:23:00]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define repf(i,k,n) for(int i=k; i<n; i++)
#define rep(i,n) for(int i=0; i<n; i++)
#define all(v) v.begin(), v.end()
#define SZ(v) int(v.size())
typedef vector<int> vi;

//QOJ.ac 2nd Uni Cap - stage 16 F
int main(){ 
	ios::sync_with_stdio(0); cin.tie(0);
	int n,m; cin>>n>>m;
	vector<vi> adj(n);
	rep(i,m){
		int a,b; cin>>a>>b;
		a--;b--;
		adj[a].push_back(b);
		adj[b].push_back(a);
	}
	int mx1=0,mx2=0;
	rep(i,n){
		mx2=max(mx2,SZ(adj[i]));
		if(mx2>mx1) swap(mx2,mx1);
	}
	if(mx1-mx2>=5){
		cout << "ok" << '\n';
		return 0;
	}
	rep(i,n) if(SZ(adj[i])==mx1){
		cout << 5 << '\n';
		sort(all(adj[i]));
		int j=0,k=0;
		rep(t,5){
			while(adj[i][k]<j) k++;
			while(adj[i][k]==j) j++,k++;
			cout << i+1 << ' ' << j+1 << '\n';
			j++;
		}
	}
	
	return 0;
}

详细

Test #1:

score: 0
Wrong Answer on the first run

input:

1000 3560
603 151
415 20
102 569
895 552
678 734
24 614
689 518
440 223
751 919
223 433
711 551
502 634
706 583
812 501
514 535
780 751
720 530
532 384
888 139
864 791
292 675
171 881
30 592
464 557
280 299
654 650
894 335
250 532
792 10
83 969
118 771
579 300
852 983
243 940
957 939
817 889
911 319...

output:

5
310 1
310 2
310 3
310 4
310 5
5
733 1
733 2
733 3
733 4
733 5

input:


output:


result:

wrong answer Token "5" doesn't correspond to pattern "mark"