Submission #850695

# Submission time Handle Problem Language Result Execution time Memory
850695 2023-09-17T09:47:01 Z d4xn Inside information (BOI21_servers) C++17
5 / 100
212 ms 524288 KB
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math,inline")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,lzcnt,mmx,abm,avx,avx2,fma")
#include <bits/stdc++.h>

using namespace std;

const int N = 120000;

int n, k;
bitset<N> bt[N];

signed main() {
  ios::sync_with_stdio(false); cin.tie(nullptr);

  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    bt[i][i] = 1;
  }

  for (int i = 0; i < n+k-1; i++) {
    char tp;
    cin >> tp;
    if (tp == 'S') {
      int x, y;
      cin >> x >> y;
      x--; y--;

      // bt[x] = bt[y] = (bt[x] | bt[y]);
      bt[x] |= bt[y];
      bt[y] |= bt[x];
    }
    else if (tp == 'Q') {
      int x, z;
      cin >> x >> z;
      x--; z--;

      if (bt[x][z]) cout << "yes\n";
      else cout << "no\n";
    }
    else {
      int z;
      cin >> z;
      z--;

      int ans = 0;
      for (int i = 0; i < n; i++) {
        if (bt[i][z]) ans++;
      }
      cout << ans << "\n";
    }
  }
}
# Verdict Execution time Memory Grader output
1 Correct 16 ms 2904 KB Output is correct
2 Correct 36 ms 60252 KB Output is correct
3 Correct 33 ms 60496 KB Output is correct
4 Correct 36 ms 60248 KB Output is correct
5 Correct 36 ms 60508 KB Output is correct
6 Correct 34 ms 60500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 2904 KB Output is correct
2 Correct 36 ms 60252 KB Output is correct
3 Correct 33 ms 60496 KB Output is correct
4 Correct 36 ms 60248 KB Output is correct
5 Correct 36 ms 60508 KB Output is correct
6 Correct 34 ms 60500 KB Output is correct
7 Correct 15 ms 2904 KB Output is correct
8 Correct 209 ms 60244 KB Output is correct
9 Correct 200 ms 60500 KB Output is correct
10 Correct 212 ms 60240 KB Output is correct
11 Correct 212 ms 60500 KB Output is correct
12 Correct 193 ms 60808 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 2908 KB Output is correct
2 Runtime error 93 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 2908 KB Output is correct
2 Runtime error 93 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 2908 KB Output is correct
2 Runtime error 94 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 2908 KB Output is correct
2 Runtime error 94 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 2904 KB Output is correct
2 Runtime error 94 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 2904 KB Output is correct
2 Runtime error 94 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 2908 KB Output is correct
2 Runtime error 101 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 2908 KB Output is correct
2 Runtime error 101 ms 524288 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 2908 KB Output is correct
2 Correct 41 ms 60388 KB Output is correct
3 Correct 32 ms 60496 KB Output is correct
4 Correct 37 ms 60492 KB Output is correct
5 Correct 35 ms 60268 KB Output is correct
6 Correct 34 ms 60360 KB Output is correct
7 Correct 15 ms 2904 KB Output is correct
8 Runtime error 94 ms 524288 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 2908 KB Output is correct
2 Correct 41 ms 60388 KB Output is correct
3 Correct 32 ms 60496 KB Output is correct
4 Correct 37 ms 60492 KB Output is correct
5 Correct 35 ms 60268 KB Output is correct
6 Correct 34 ms 60360 KB Output is correct
7 Correct 15 ms 2904 KB Output is correct
8 Runtime error 94 ms 524288 KB Execution killed with signal 9
9 Halted 0 ms 0 KB -