QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#321903 | #4829. Mark on a Graph | socpite | 0 | 2ms | 3772kb | C++14 | 835b | 2024-02-05 21:28:06 | 2024-02-05 21:28:06 |
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 + 15)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: 3772kb
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
time: 1ms
memory: 3756kb
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:
mark 5 747 1 747 2 747 3 747 4 747 5
input:
1000 2005 711 181 320 426 386 503 377 826 97 233 792 231 1 993 440 112 532 381 81 879 505 764 37 6 935 217 424 667 252 673 751 756 178 529 731 827 689 39 764 431 882 331 763 804 727 755 904 500 999 663 53 985 564 74 863 90 543 99 25 858 528 824 411 674 705 758 569 980 414 78 164 502 633 94 50 924 51...
output:
mark 5 528 1 528 2 528 3 528 4 528 5
result:
wrong answer Token "mark" doesn't correspond to pattern "ok"