QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#321909 | #4829. Mark on a Graph | socpite | 0 | 2ms | 3752kb | C++14 | 841b | 2024-02-05 21:32:42 | 2024-02-05 21:32:42 |
answer
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1e3+5;
vector<int> g[maxn];
int used[maxn];
int main(){
int n, m;
cin >> n >> m;
for(int i = 0; i < m; i++){
int a, b;
cin >> a >> b;
g[a].push_back(b);
g[b].push_back(a);
}
int mn = 1;
for(int i = 1; i <= n; i++){
if(g[i].size() > g[mn].size())mn = i;
}
// cout << mn << " " << g[mn].size() << endl;
if(g[mn].size() >= m*2/n + 8*m/2000)cout << "ok";
else{
cout << "mark\n";
cout << "5\n";
int cnt = 0;
for(auto v: g[mn])used[v] = 1;
for(int i = 1; i <= n; i++){
if(used[i] || i == mn)continue;
cout << mn << " " << i << "\n";
cnt++;
if(cnt == 5)return 0;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3752kb
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 310 1 310 2 310 3 310 4 310 5
input:
1000 3565 721 353 295 222 429 542 522 656 682 141 194 833 746 181 656 841 263 583 392 102 221 187 643 633 788 161 180 790 481 180 640 763 583 378 224 873 974 302 521 639 368 691 720 39 113 433 679 583 16 526 882 125 351 806 70 757 464 840 87 733 161 916 232 79 178 201 182 394 201 34 883 528 916 901 ...
output:
ok
result:
ok all right
Test #2:
score: 0
Wrong Answer on the first run
input:
1000 2000 457 335 160 497 464 992 892 255 853 3 308 301 970 363 541 299 89 418 425 128 626 827 603 854 484 874 755 295 607 483 798 552 356 850 320 357 254 940 675 901 168 525 301 636 520 555 773 910 343 701 889 966 218 529 909 950 71 64 682 284 424 138 721 792 670 544 386 72 654 909 725 235 592 437 ...
output:
ok
input:
output:
result:
wrong answer Token "ok" doesn't correspond to pattern "mark"