Submission #1108329

# Submission time Handle Problem Language Result Execution time Memory
1108329 2024-11-03T19:16:50 Z LucaLucaM Digital Circuit (IOI22_circuit) C++17
0 / 100
3000 ms 1616 KB
#ifdef LOCAL
#include "grader.h"
#else
#include "circuit.h"
#endif
#include <vector>

using ll = long long;

const int NMAX = 2e5;
const int mod = 1e9 + 2022;

int depth[NMAX];
int p2[NMAX];
std::vector<int> a;
int n, m;

void init(int N, int M, std::vector<int> parent, std::vector<int> A) {
  n = N;
  m = M;
  a = A;
  p2[0] = 1;
  for (int i = 1; i < n + m; i++) {
    depth[i] = 1 + depth[parent[i]];
    p2[i] = p2[i - 1] * 2 % mod;
  }
} 

int count_ways(int L, int R) {
  L -= n, R -= n;
  for (int i = L; i <= R; i++) {
    a[i] ^= 1;
  }
  ll answer = 0;
  for (int i = 0; i < m; i++) {
    if (a[i]) {
      answer += p2[depth[i + n]];
    }
  }
  return answer % mod;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB 1st lines differ - on the 1st token, expected: '1', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB 1st lines differ - on the 1st token, expected: '1', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB 1st lines differ - on the 1st token, expected: '1', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3080 ms 1616 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 3080 ms 1616 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB 1st lines differ - on the 1st token, expected: '1', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB 1st lines differ - on the 1st token, expected: '1', found: '2'
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 336 KB 1st lines differ - on the 1st token, expected: '1', found: '2'
2 Halted 0 ms 0 KB -