QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#311505#4829. Mark on a Graphsinsop900 0ms7624kbC++14740b2024-01-22 14:29:562024-01-22 14:29:57

Judging History

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

  • [2024-01-22 14:29:57]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:7624kb
  • [2024-01-22 14:29:56]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int maxn = 1005;
int n, m, vis[maxn][maxn], deg[maxn], p[maxn];
vector<pair<int, int>> ans;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> n >> m;
	for(int i = 1, u, v;i <= m;i++) {
		cin >> u >> v;
		vis[u][v] = vis[v][u] = 1;
		deg[u] ++, deg[v] ++;
	}
	for(int i = 1;i <= n;i++) p[i] = i;
	sort(p + 1, p + 1 + n, [&](int a, int b) {return deg[a] > deg[b];});
	for(int i = 1;i <= 5;i++) {
		if(!vis[p[i]][p[i % 5 + 1]]) ans.push_back(make_pair(p[i], p[i % 5 + 1]));
	}
	if(!ans.size()) {
		cout << "ok";
	}
	else {
		cout << "mark " << ans.size() << "\n";
		for(pair<int, int> t : ans) cout << t.first << " " << t.second << '\n';
	}
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 7624kb

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:

mark 5
733 310
310 252
252 494
494 139
139 733

input:

1000 3565
721 353
295 222
429 542
534 977
682 141
495 833
746 181
656 841
184 255
392 102
439 187
643 633
448 161
180 790
655 180
484 763
439 897
224 873
974 302
521 734
368 691
794 262
113 49
66 583
16 526
457 125
567 806
70 757
464 840
87 733
161 397
232 412
178 201
182 394
201 34
992 583
221 937
...

output:

mark 2
31 54
997 353

result:

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