/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
int erased[3000],f[3001][3001];
vector <int> v[3001];
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n,m;
cin>>n>>m;
for(int i=0;i<m;i++){
int a,b;
cin>>a>>b;
f[a][b]=f[b][a]=1;
}
for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) if(i!=j&&f[i][j]==0) v[i].push_back(j);
int cnt=0;
for(int i=1;i<=n&&cnt<n/3;i++){
if(erased[i]==1) continue;
for(int j:v[i]){
if(erased[j]==0){
cnt++;
erased[j]=1;
erased[i]=1;
break;
}
}
}
cnt=0;
for(int i=1;i<=n&&cnt<n/3;i++){
if(erased[i]==0){
cout<<i<<" ";
cnt++;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2392 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
4700 KB |
Output is correct |
2 |
Correct |
9 ms |
7004 KB |
Output is correct |
3 |
Correct |
9 ms |
7004 KB |
Output is correct |
4 |
Correct |
9 ms |
7004 KB |
Output is correct |
5 |
Correct |
9 ms |
7004 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
7000 KB |
Output is correct |
2 |
Correct |
36 ms |
14164 KB |
Output is correct |
3 |
Correct |
36 ms |
14160 KB |
Output is correct |
4 |
Correct |
37 ms |
14164 KB |
Output is correct |
5 |
Correct |
35 ms |
14192 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
9308 KB |
Output is correct |
2 |
Correct |
85 ms |
21372 KB |
Output is correct |
3 |
Correct |
85 ms |
21376 KB |
Output is correct |
4 |
Correct |
84 ms |
21328 KB |
Output is correct |
5 |
Correct |
88 ms |
21328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
14416 KB |
Output is correct |
2 |
Correct |
136 ms |
28048 KB |
Output is correct |
3 |
Correct |
128 ms |
27988 KB |
Output is correct |
4 |
Correct |
136 ms |
28068 KB |
Output is correct |
5 |
Correct |
162 ms |
27984 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
82 ms |
22612 KB |
Output is correct |
2 |
Correct |
173 ms |
30620 KB |
Output is correct |
3 |
Correct |
155 ms |
30544 KB |
Output is correct |
4 |
Correct |
148 ms |
30548 KB |
Output is correct |
5 |
Correct |
147 ms |
30612 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
138 ms |
32664 KB |
Output is correct |
2 |
Correct |
288 ms |
35412 KB |
Output is correct |
3 |
Correct |
259 ms |
35488 KB |
Output is correct |
4 |
Correct |
278 ms |
35412 KB |
Output is correct |
5 |
Correct |
318 ms |
35408 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
265 ms |
38324 KB |
Output is correct |
2 |
Correct |
372 ms |
38052 KB |
Output is correct |
3 |
Correct |
386 ms |
38048 KB |
Output is correct |
4 |
Correct |
406 ms |
38228 KB |
Output is correct |
5 |
Correct |
427 ms |
38056 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
345 ms |
43172 KB |
Output is correct |
2 |
Correct |
467 ms |
40616 KB |
Output is correct |
3 |
Correct |
477 ms |
40632 KB |
Output is correct |
4 |
Correct |
535 ms |
40620 KB |
Output is correct |
5 |
Correct |
522 ms |
40784 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
445 ms |
46520 KB |
Output is correct |
2 |
Correct |
557 ms |
43344 KB |
Output is correct |
3 |
Correct |
672 ms |
43436 KB |
Output is correct |
4 |
Correct |
644 ms |
43340 KB |
Output is correct |
5 |
Correct |
621 ms |
43344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
628 ms |
50344 KB |
Output is correct |
2 |
Correct |
628 ms |
44628 KB |
Output is correct |
3 |
Correct |
615 ms |
44624 KB |
Output is correct |
4 |
Correct |
661 ms |
44456 KB |
Output is correct |
5 |
Correct |
648 ms |
44624 KB |
Output is correct |