답안 #1099925

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1099925 2024-10-12T05:52:50 Z model_code 스핑크스 (IOI24_sphinx) C++17
21.5 / 100
420 ms 1192 KB
// partially_correct/subtask3-partial-lessq.cpp

#include <queue>

#include "sphinx.h"

using namespace std;

int count_comp(int N, vector<vector<int>> &adj, int u, int v) {
  int cnt = 0;
  vector<bool> vis(N, false);
  queue<int> q;
  for (int i = 0; i < N; ++i) {
    if (i == u || i == v || vis[i]) continue;
    ++cnt;
    vis[i] = true;
    q.push(i);
    while (!q.empty()) {
      int cur = q.front();
      q.pop();
      for (int nxt : adj[cur]) {
        if (nxt == u || nxt == v || vis[nxt]) continue;
        vis[nxt] = true;
        q.push(nxt);
      }
    }
  }
  return cnt;
}

vector<int> find_colours(int N, vector<int> X, vector<int> Y) {
  vector<vector<int>> adj, e;
  adj.assign(N, {}), e.assign(N, {});
  int M = X.size();
  for (int i = 0; i < M; ++i)
    adj[X[i]].push_back(Y[i]), adj[Y[i]].push_back(X[i]);
  for (int i = 0; i < M; ++i) {
    vector<int> ord(N, N);
    ord[X[i]] = ord[Y[i]] = -1;
    int cnt = count_comp(N, adj, X[i], Y[i]);
    if (perform_experiment(ord) == cnt + 1) {
      e[X[i]].push_back(Y[i]);
      e[Y[i]].push_back(X[i]);
    }
  }

  vector<int> F(N, -1);
  int c = 0;
  queue<int> q;
  for (int i = 0; i < N; ++i) {
    if (F[i] >= 0) continue;
    F[i] = c;
    q.push(i);
    while (!q.empty()) {
      int cur = q.front();
      q.pop();
      for (int nxt : e[cur]) {
        if (F[nxt] == -1) {
          F[nxt] = c;
          q.push(nxt);
        }
      }
    }
    ++c;
  }
  return F;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 596 KB #experiments: 1
2 Correct 1 ms 344 KB #experiments: 1
3 Partially correct 1 ms 344 KB Partially correct
4 Partially correct 1 ms 384 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB Partially correct
2 Correct 1 ms 596 KB #experiments: 1
3 Correct 1 ms 344 KB #experiments: 1
4 Partially correct 1 ms 344 KB Partially correct
5 Partially correct 1 ms 384 KB Partially correct
6 Partially correct 1 ms 344 KB Partially correct
7 Partially correct 2 ms 344 KB Partially correct
8 Partially correct 1 ms 344 KB Partially correct
9 Partially correct 1 ms 344 KB Partially correct
10 Partially correct 1 ms 428 KB Partially correct
11 Partially correct 1 ms 344 KB Partially correct
12 Partially correct 1 ms 344 KB Partially correct
13 Partially correct 0 ms 344 KB Partially correct
14 Partially correct 26 ms 468 KB Partially correct
15 Partially correct 20 ms 344 KB Partially correct
16 Partially correct 21 ms 344 KB Partially correct
17 Partially correct 14 ms 344 KB Partially correct
18 Partially correct 25 ms 344 KB Partially correct
19 Partially correct 19 ms 344 KB Partially correct
20 Partially correct 15 ms 344 KB Partially correct
21 Partially correct 13 ms 344 KB Partially correct
22 Partially correct 6 ms 344 KB Partially correct
23 Partially correct 7 ms 344 KB Partially correct
24 Partially correct 7 ms 344 KB Partially correct
25 Partially correct 8 ms 344 KB Partially correct
26 Partially correct 1 ms 428 KB Partially correct
27 Partially correct 1 ms 348 KB Partially correct
28 Partially correct 1 ms 344 KB Partially correct
29 Partially correct 3 ms 348 KB Partially correct
30 Partially correct 7 ms 356 KB Partially correct
31 Partially correct 14 ms 344 KB Partially correct
32 Partially correct 12 ms 344 KB Partially correct
33 Partially correct 2 ms 436 KB Partially correct
34 Partially correct 10 ms 348 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 596 KB #experiments: 1
2 Correct 1 ms 344 KB #experiments: 1
3 Partially correct 1 ms 344 KB Partially correct
4 Partially correct 1 ms 384 KB Partially correct
5 Partially correct 1 ms 344 KB Partially correct
6 Partially correct 2 ms 344 KB Partially correct
7 Partially correct 1 ms 344 KB Partially correct
8 Partially correct 1 ms 344 KB Partially correct
9 Partially correct 1 ms 428 KB Partially correct
10 Partially correct 1 ms 344 KB Partially correct
11 Partially correct 1 ms 344 KB Partially correct
12 Partially correct 0 ms 344 KB Partially correct
13 Partially correct 5 ms 352 KB Partially correct
14 Partially correct 6 ms 352 KB Partially correct
15 Partially correct 5 ms 460 KB Partially correct
16 Partially correct 7 ms 456 KB Partially correct
17 Partially correct 7 ms 608 KB Partially correct
18 Partially correct 5 ms 344 KB Partially correct
19 Partially correct 5 ms 348 KB Partially correct
20 Partially correct 9 ms 712 KB Partially correct
21 Partially correct 5 ms 348 KB Partially correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 596 KB #experiments: 1
2 Correct 1 ms 344 KB #experiments: 1
3 Partially correct 1 ms 344 KB Partially correct
4 Partially correct 1 ms 384 KB Partially correct
5 Partially correct 26 ms 468 KB Partially correct
6 Partially correct 20 ms 344 KB Partially correct
7 Partially correct 21 ms 344 KB Partially correct
8 Partially correct 14 ms 344 KB Partially correct
9 Partially correct 25 ms 344 KB Partially correct
10 Partially correct 19 ms 344 KB Partially correct
11 Partially correct 15 ms 344 KB Partially correct
12 Partially correct 13 ms 344 KB Partially correct
13 Incorrect 420 ms 1192 KB #experiments reached 2751
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB Partially correct
2 Correct 1 ms 596 KB #experiments: 1
3 Correct 1 ms 344 KB #experiments: 1
4 Partially correct 1 ms 344 KB Partially correct
5 Partially correct 1 ms 384 KB Partially correct
6 Partially correct 1 ms 344 KB Partially correct
7 Partially correct 2 ms 344 KB Partially correct
8 Partially correct 1 ms 344 KB Partially correct
9 Partially correct 1 ms 344 KB Partially correct
10 Partially correct 1 ms 428 KB Partially correct
11 Partially correct 1 ms 344 KB Partially correct
12 Partially correct 1 ms 344 KB Partially correct
13 Partially correct 0 ms 344 KB Partially correct
14 Partially correct 26 ms 468 KB Partially correct
15 Partially correct 20 ms 344 KB Partially correct
16 Partially correct 21 ms 344 KB Partially correct
17 Partially correct 14 ms 344 KB Partially correct
18 Partially correct 25 ms 344 KB Partially correct
19 Partially correct 19 ms 344 KB Partially correct
20 Partially correct 15 ms 344 KB Partially correct
21 Partially correct 13 ms 344 KB Partially correct
22 Partially correct 6 ms 344 KB Partially correct
23 Partially correct 7 ms 344 KB Partially correct
24 Partially correct 7 ms 344 KB Partially correct
25 Partially correct 8 ms 344 KB Partially correct
26 Partially correct 1 ms 428 KB Partially correct
27 Partially correct 1 ms 348 KB Partially correct
28 Partially correct 1 ms 344 KB Partially correct
29 Partially correct 3 ms 348 KB Partially correct
30 Partially correct 7 ms 356 KB Partially correct
31 Partially correct 14 ms 344 KB Partially correct
32 Partially correct 12 ms 344 KB Partially correct
33 Partially correct 2 ms 436 KB Partially correct
34 Partially correct 10 ms 348 KB Partially correct
35 Partially correct 5 ms 352 KB Partially correct
36 Partially correct 6 ms 352 KB Partially correct
37 Partially correct 5 ms 460 KB Partially correct
38 Partially correct 7 ms 456 KB Partially correct
39 Partially correct 7 ms 608 KB Partially correct
40 Partially correct 5 ms 344 KB Partially correct
41 Partially correct 5 ms 348 KB Partially correct
42 Partially correct 9 ms 712 KB Partially correct
43 Partially correct 5 ms 348 KB Partially correct
44 Incorrect 420 ms 1192 KB #experiments reached 2751
45 Halted 0 ms 0 KB -