QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#323646 | #4829. Mark on a Graph | Insert_Username_Here | 0 | 2ms | 7556kb | C++14 | 979b | 2024-02-10 07:35:53 | 2024-02-10 07:35:54 |
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: 2ms
memory: 7556kb
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 75 309 296 309 601 309 692 309 201
input:
1000 3565 721 353 295 222 429 542 779 269 682 141 495 833 746 181 656 841 184 189 392 102 439 187 643 633 448 161 180 790 481 180 640 763 782 897 224 873 974 302 521 734 368 691 898 33 113 433 858 583 16 526 726 125 348 806 70 757 464 840 87 733 161 397 232 485 178 201 182 394 201 34 453 528 29 485 ...
output:
mark 5 352 361 352 651 352 118 352 166 352 836
result:
wrong answer Token "mark" doesn't correspond to pattern "ok"