QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#311507#4829. Mark on a Graphsinsop900 2ms7576kbC++14769b2024-01-22 14:31:292024-01-22 14:31:30

Judging History

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

  • [2024-01-22 14:31:30]
  • 评测
  • 测评结果:0
  • 用时:2ms
  • 内存:7576kb
  • [2024-01-22 14:31:29]
  • 提交

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]) ? a > b : 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';
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 7576kb

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 937
937 494
494 252
252 733

input:

1000 3565
626 643
295 222
665 338
534 338
682 275
50 833
155 262
656 841
184 95
383 844
450 259
937 771
335 355
379 167
402 763
582 250
950 401
224 802
974 277
521 246
368 663
676 977
920 351
643 831
554 526
553 125
506 102
70 757
464 840
87 733
355 37
600 53
580 201
844 267
201 14
951 583
557 937
2...

output:

mark 3
353 997
913 31
31 669

result:

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