#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
#define int long long
#define mod 1000000007
#define base 7001
#define base2 757
// #define pi acos(-1)
#define double long double
// #define ordered_set tree<int, null_type, less<int>, rb_tree_tag,tree_order_statistics_node_update>
// #define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
#pragma GCC optimize("O3,Ofast,unroll-loops")
#pragma GCC target("avx2,sse3,sse4,avx")
constexpr int maxn = 3001;
const int N = 1 << (int)(ceil(log2(maxn)));
int n, m;
bool adj[maxn][maxn];
signed main()
{
cin.tie(0) -> sync_with_stdio(0);
cin >> n >> m;
for (int i = 0; i < m; i++)
{
int x, y;
cin >> x >> y;
adj[x][y] = 1;
adj[y][x] = 1;
}
set<int>s;
for (int i = 0; i < n; i++)
s.insert(i + 1);
for (int i = 1; i <= n; i++)
{
for (int j = 1; j <= n; j++)
{
if (i != j && !adj[i][j] && s.find(i) != s.end() && s.find(j) != s.end())
{
s.erase(i);
s.erase(j);
}
}
}
int cnt = 0;
for (auto i : s)
{
if (cnt >= n / 3)
return 0;
cout << i << " ";
cnt++;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
600 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
2652 KB |
Output is correct |
4 |
Correct |
1 ms |
2652 KB |
Output is correct |
5 |
Correct |
1 ms |
2652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2652 KB |
Output is correct |
2 |
Correct |
9 ms |
2648 KB |
Output is correct |
3 |
Correct |
9 ms |
2652 KB |
Output is correct |
4 |
Correct |
9 ms |
2652 KB |
Output is correct |
5 |
Correct |
10 ms |
2652 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
2652 KB |
Output is correct |
2 |
Correct |
35 ms |
4732 KB |
Output is correct |
3 |
Correct |
37 ms |
4696 KB |
Output is correct |
4 |
Correct |
37 ms |
4700 KB |
Output is correct |
5 |
Correct |
41 ms |
4732 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
2652 KB |
Output is correct |
2 |
Correct |
94 ms |
6748 KB |
Output is correct |
3 |
Correct |
88 ms |
6748 KB |
Output is correct |
4 |
Correct |
88 ms |
6764 KB |
Output is correct |
5 |
Correct |
90 ms |
6780 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
27 ms |
4700 KB |
Output is correct |
2 |
Correct |
125 ms |
6776 KB |
Output is correct |
3 |
Correct |
128 ms |
6748 KB |
Output is correct |
4 |
Correct |
150 ms |
6780 KB |
Output is correct |
5 |
Correct |
134 ms |
6744 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
84 ms |
6748 KB |
Output is correct |
2 |
Correct |
148 ms |
6760 KB |
Output is correct |
3 |
Correct |
148 ms |
6744 KB |
Output is correct |
4 |
Correct |
156 ms |
6748 KB |
Output is correct |
5 |
Correct |
182 ms |
6744 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
144 ms |
6748 KB |
Output is correct |
2 |
Correct |
207 ms |
8796 KB |
Output is correct |
3 |
Correct |
236 ms |
8820 KB |
Output is correct |
4 |
Correct |
252 ms |
8836 KB |
Output is correct |
5 |
Correct |
214 ms |
8828 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
194 ms |
8792 KB |
Output is correct |
2 |
Correct |
277 ms |
8792 KB |
Output is correct |
3 |
Correct |
246 ms |
9044 KB |
Output is correct |
4 |
Correct |
252 ms |
8792 KB |
Output is correct |
5 |
Correct |
281 ms |
8796 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
252 ms |
8792 KB |
Output is correct |
2 |
Correct |
311 ms |
8796 KB |
Output is correct |
3 |
Correct |
310 ms |
8792 KB |
Output is correct |
4 |
Correct |
306 ms |
8836 KB |
Output is correct |
5 |
Correct |
323 ms |
8792 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
267 ms |
8820 KB |
Output is correct |
2 |
Correct |
343 ms |
8952 KB |
Output is correct |
3 |
Correct |
322 ms |
9044 KB |
Output is correct |
4 |
Correct |
332 ms |
9088 KB |
Output is correct |
5 |
Correct |
317 ms |
9044 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
307 ms |
9244 KB |
Output is correct |
2 |
Correct |
331 ms |
9296 KB |
Output is correct |
3 |
Correct |
340 ms |
9444 KB |
Output is correct |
4 |
Correct |
341 ms |
9248 KB |
Output is correct |
5 |
Correct |
338 ms |
9268 KB |
Output is correct |