QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#323647#4829. Mark on a GraphInsert_Username_Here0 1ms7720kbC++14979b2024-02-10 07:37:172024-02-10 07:37:18

Judging History

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

  • [2024-02-10 07:37:18]
  • 评测
  • 测评结果:0
  • 用时:1ms
  • 内存:7720kb
  • [2024-02-10 07:37:17]
  • 提交

answer

#include <bits/stdc++.h>
#define f first
#define s second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pii;
const ll mod = 1e9 + 7;
// cope counter = 2254

int adj[1001][1001], cnt[1001];

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	int u, v;
	for(int i = 0; i < m; i++) {
		cin >> u >> v;
		u--, v--;
		cnt[u]++, cnt[v]++;
		adj[u][v] = adj[v][u] = 1;
	}
	cnt[n] = 0;
	u = v = n;
	for(int i = 0; i < n; i++) {
		if(cnt[i] > cnt[v]) v = i;
		if(cnt[v] > cnt[u]) swap(u, v);
	}
	if(cnt[u] - cnt[v] > 4) {
		cout << "ok\n";
		return 0;
	}
	v = 0;
	cout << "mark\n5\n";
	int arr[n];
	for(int i = 0; i < n; i++) arr[i] = i;
	mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
	shuffle(arr, arr + n, rng);
	for(int i = 0; i < n; i++) {
		if(!adj[u][arr[i]]) {
			v++;
			cout << u << " " << arr[i] << "\n";
		}
		if(v == 5) break;
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 7720kb

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
309 230
309 295
309 945
309 956
309 404

input:

1000 3565
626 643
295 222
665 338
534 977
682 275
495 833
155 262
656 841
184 255
383 844
439 187
937 771
448 161
379 167
655 180
484 763
439 897
224 802
974 277
521 734
368 663
794 364
113 49
66 583
554 526
457 125
567 806
70 757
955 736
87 733
161 397
232 412
580 201
844 267
201 14
992 583
65 485
...

output:

mark
5
352 446
352 539
352 67
352 270
352 409

result:

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