Submission #1005511

# Submission time Handle Problem Language Result Execution time Memory
1005511 2024-06-22T14:03:46 Z basa Party (POI11_imp) C++14
100 / 100
371 ms 9304 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long

const int maxn = 3005;

bool adj[maxn][maxn];

signed main()
{
  cin.tie(0) -> sync_with_stdio(0);
  int n, m;
  cin >> n >> m;

  for(int i = 0; i < m; i++){
    int u, v;
    cin >> u >> v;

    adj[u][v] = 1;
    adj[v][u] = 1;
  }

  bool skip[n + 5] = {};
  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++){
      if(skip[i] || skip[j] || i == j) continue;

      if(!adj[i][j]){
        skip[i] = 1;
        skip[j] = 1;
        break;
      }
    }
  }

  int t = 0;
  vector<int>ans;
  for(int i = 1; i <= n && t < n / 3; i++){
    if(skip[i]) continue;

    t++;
    ans.push_back(i);
  }

  for(int i : ans) cout << i << ' ';
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 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
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Correct 8 ms 2704 KB Output is correct
3 Correct 8 ms 2652 KB Output is correct
4 Correct 8 ms 2648 KB Output is correct
5 Correct 8 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2652 KB Output is correct
2 Correct 27 ms 4756 KB Output is correct
3 Correct 30 ms 4700 KB Output is correct
4 Correct 30 ms 4696 KB Output is correct
5 Correct 32 ms 4728 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 2652 KB Output is correct
2 Correct 77 ms 6792 KB Output is correct
3 Correct 96 ms 6748 KB Output is correct
4 Correct 89 ms 6748 KB Output is correct
5 Correct 69 ms 6744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 4744 KB Output is correct
2 Correct 111 ms 6776 KB Output is correct
3 Correct 112 ms 6744 KB Output is correct
4 Correct 112 ms 6776 KB Output is correct
5 Correct 101 ms 6748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 80 ms 6792 KB Output is correct
2 Correct 139 ms 6744 KB Output is correct
3 Correct 143 ms 6796 KB Output is correct
4 Correct 138 ms 6796 KB Output is correct
5 Correct 142 ms 6744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 119 ms 6748 KB Output is correct
2 Correct 179 ms 8796 KB Output is correct
3 Correct 186 ms 8796 KB Output is correct
4 Correct 187 ms 8792 KB Output is correct
5 Correct 179 ms 8792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 176 ms 8796 KB Output is correct
2 Correct 202 ms 8848 KB Output is correct
3 Correct 222 ms 9044 KB Output is correct
4 Correct 195 ms 8792 KB Output is correct
5 Correct 230 ms 8792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 205 ms 8796 KB Output is correct
2 Correct 257 ms 8828 KB Output is correct
3 Correct 253 ms 8796 KB Output is correct
4 Correct 272 ms 8796 KB Output is correct
5 Correct 305 ms 8832 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 239 ms 8792 KB Output is correct
2 Correct 314 ms 8972 KB Output is correct
3 Correct 291 ms 8792 KB Output is correct
4 Correct 290 ms 8796 KB Output is correct
5 Correct 296 ms 8796 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 294 ms 9280 KB Output is correct
2 Correct 309 ms 9288 KB Output is correct
3 Correct 325 ms 9260 KB Output is correct
4 Correct 361 ms 9304 KB Output is correct
5 Correct 371 ms 9304 KB Output is correct