답안 #824354

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
824354 2023-08-14T04:03:58 Z boyliguanhan 디지털 회로 (IOI22_circuit) C++17
18 / 100
2172 ms 2097152 KB
#include "circuit.h"
#include<bits/stdc++.h>
using namespace std;
long long tm = 1, l[80100], r[80100], v[80100], cont[80100], lz[80100], mod = 1000002022, st[20100], nn, deg[20100], Cont[10010];
set<int> nansc[20100];
void pd(int n) {
  if(lz[n]){
    v[n]=cont[n]-v[n];
    lz[n]=0;
    if(l[n]!=r[n])
      lz[n*2]^=1,lz[n*2+1]^=1;
  }
}
void build(int i, int L, int R) {
  l[i] = L;
  r[i] = R;
  if(L==R) {
    cont[i] = Cont[L];
    v[i] = st[L]*cont[i];
  } else {
    build(i*2,L,L+R>>1);
    build(i*2+1,L+R+2>>1, R);
    cont[i] = cont[i*2]+cont[i*2+1];
    v[i] = v[i*2]+v[i*2+1];
  }
}
void update(int i, int tl, int tr) {
  if(tl<=l[i]&&r[i]<=tr) 
    lz[i]^=1, tr=-1;
  pd(i);
  if(l[i]>tr||tl>r[i])
    return;
  update(i*2,tl,tr);
  update(i*2+1,tl,tr);
  v[i] = v[i*2]+v[i*2+1];
}
void init(int N, int M, vector<int> P, vector<int> A) {
  for(int i = 0; i < N; i++)
    nansc[0].insert(i);
  nn=N;
  for(int i = 0; i < M; i++)
    st[i] = A[i];
  for(int i = 1; i < N+M; i++){
    deg[P[i]]++;
    nansc[i] = nansc[P[i]];
    nansc[i].erase(P[i]);
  }
  for(int i = N; i < N+M; i++) {
    Cont[i-N] = 1;
    for(auto j: nansc[i])
      Cont[i-N] = (Cont[i-N]*deg[j])%mod;
  }
  build(1,0,M-1);
}
int count_ways(int L, int R) {
  update(1,L-nn,R-nn);
  return v[1]%mod;
}

Compilation message

circuit.cpp: In function 'void build(int, int, int)':
circuit.cpp:21:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   21 |     build(i*2,L,L+R>>1);
      |                 ~^~
circuit.cpp:22:20: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   22 |     build(i*2+1,L+R+2>>1, R);
      |                 ~~~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1232 KB Output is correct
2 Correct 1 ms 1232 KB Output is correct
3 Correct 1 ms 1384 KB Output is correct
4 Correct 1 ms 1360 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
8 Correct 1 ms 1360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1232 KB Output is correct
2 Correct 6 ms 7248 KB Output is correct
3 Correct 30 ms 25400 KB Output is correct
4 Correct 29 ms 25444 KB Output is correct
5 Correct 30 ms 25396 KB Output is correct
6 Correct 58 ms 50132 KB Output is correct
7 Correct 108 ms 94092 KB Output is correct
8 Correct 112 ms 94036 KB Output is correct
9 Correct 110 ms 94056 KB Output is correct
10 Correct 56 ms 48200 KB Output is correct
11 Correct 54 ms 48148 KB Output is correct
12 Correct 85 ms 68192 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1232 KB Output is correct
2 Correct 1 ms 1232 KB Output is correct
3 Correct 1 ms 1384 KB Output is correct
4 Correct 1 ms 1360 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
8 Correct 1 ms 1360 KB Output is correct
9 Correct 1 ms 1232 KB Output is correct
10 Correct 6 ms 7248 KB Output is correct
11 Correct 30 ms 25400 KB Output is correct
12 Correct 29 ms 25444 KB Output is correct
13 Correct 30 ms 25396 KB Output is correct
14 Correct 58 ms 50132 KB Output is correct
15 Correct 108 ms 94092 KB Output is correct
16 Correct 112 ms 94036 KB Output is correct
17 Correct 110 ms 94056 KB Output is correct
18 Correct 56 ms 48200 KB Output is correct
19 Correct 54 ms 48148 KB Output is correct
20 Correct 85 ms 68192 KB Output is correct
21 Correct 70 ms 57160 KB Output is correct
22 Correct 56 ms 49480 KB Output is correct
23 Correct 53 ms 38196 KB Output is correct
24 Correct 110 ms 94492 KB Output is correct
25 Correct 110 ms 94272 KB Output is correct
26 Correct 119 ms 94612 KB Output is correct
27 Correct 111 ms 94404 KB Output is correct
28 Correct 111 ms 94644 KB Output is correct
29 Correct 1 ms 1360 KB Output is correct
30 Correct 1 ms 1360 KB Output is correct
31 Correct 23 ms 24692 KB Output is correct
32 Correct 117 ms 94024 KB Output is correct
33 Correct 48 ms 35788 KB Output is correct
34 Correct 18 ms 15568 KB Output is correct
35 Correct 1 ms 1360 KB Output is correct
36 Correct 57 ms 48264 KB Output is correct
37 Correct 24 ms 24784 KB Output is correct
38 Correct 23 ms 24784 KB Output is correct
39 Correct 39 ms 33984 KB Output is correct
40 Correct 48 ms 32764 KB Output is correct
41 Correct 29 ms 22184 KB Output is correct
42 Correct 3 ms 3152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2029 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2029 ms 2097152 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1232 KB Output is correct
2 Correct 6 ms 7248 KB Output is correct
3 Correct 30 ms 25400 KB Output is correct
4 Correct 29 ms 25444 KB Output is correct
5 Correct 30 ms 25396 KB Output is correct
6 Correct 58 ms 50132 KB Output is correct
7 Correct 108 ms 94092 KB Output is correct
8 Correct 112 ms 94036 KB Output is correct
9 Correct 110 ms 94056 KB Output is correct
10 Correct 56 ms 48200 KB Output is correct
11 Correct 54 ms 48148 KB Output is correct
12 Correct 85 ms 68192 KB Output is correct
13 Runtime error 2029 ms 2097152 KB Execution killed with signal 9
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1232 KB Output is correct
2 Correct 1 ms 1232 KB Output is correct
3 Correct 1 ms 1384 KB Output is correct
4 Correct 1 ms 1360 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
8 Correct 1 ms 1360 KB Output is correct
9 Correct 1 ms 1232 KB Output is correct
10 Correct 6 ms 7248 KB Output is correct
11 Correct 30 ms 25400 KB Output is correct
12 Correct 29 ms 25444 KB Output is correct
13 Correct 30 ms 25396 KB Output is correct
14 Correct 58 ms 50132 KB Output is correct
15 Correct 108 ms 94092 KB Output is correct
16 Correct 112 ms 94036 KB Output is correct
17 Correct 110 ms 94056 KB Output is correct
18 Correct 56 ms 48200 KB Output is correct
19 Correct 54 ms 48148 KB Output is correct
20 Correct 85 ms 68192 KB Output is correct
21 Correct 70 ms 57160 KB Output is correct
22 Correct 56 ms 49480 KB Output is correct
23 Correct 53 ms 38196 KB Output is correct
24 Correct 110 ms 94492 KB Output is correct
25 Correct 110 ms 94272 KB Output is correct
26 Correct 119 ms 94612 KB Output is correct
27 Correct 111 ms 94404 KB Output is correct
28 Correct 111 ms 94644 KB Output is correct
29 Correct 1 ms 1360 KB Output is correct
30 Correct 1 ms 1360 KB Output is correct
31 Correct 23 ms 24692 KB Output is correct
32 Correct 117 ms 94024 KB Output is correct
33 Correct 48 ms 35788 KB Output is correct
34 Correct 18 ms 15568 KB Output is correct
35 Correct 1 ms 1360 KB Output is correct
36 Correct 57 ms 48264 KB Output is correct
37 Correct 24 ms 24784 KB Output is correct
38 Correct 23 ms 24784 KB Output is correct
39 Correct 39 ms 33984 KB Output is correct
40 Correct 48 ms 32764 KB Output is correct
41 Correct 29 ms 22184 KB Output is correct
42 Correct 3 ms 3152 KB Output is correct
43 Correct 1442 ms 801424 KB Output is correct
44 Correct 2172 ms 1270028 KB Output is correct
45 Correct 2053 ms 1004416 KB Output is correct
46 Runtime error 1457 ms 2097152 KB Execution killed with signal 9
47 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1232 KB Output is correct
2 Correct 1 ms 1232 KB Output is correct
3 Correct 1 ms 1384 KB Output is correct
4 Correct 1 ms 1360 KB Output is correct
5 Correct 1 ms 1360 KB Output is correct
6 Correct 1 ms 1360 KB Output is correct
7 Correct 1 ms 1360 KB Output is correct
8 Correct 1 ms 1360 KB Output is correct
9 Correct 1 ms 1232 KB Output is correct
10 Correct 6 ms 7248 KB Output is correct
11 Correct 30 ms 25400 KB Output is correct
12 Correct 29 ms 25444 KB Output is correct
13 Correct 30 ms 25396 KB Output is correct
14 Correct 58 ms 50132 KB Output is correct
15 Correct 108 ms 94092 KB Output is correct
16 Correct 112 ms 94036 KB Output is correct
17 Correct 110 ms 94056 KB Output is correct
18 Correct 56 ms 48200 KB Output is correct
19 Correct 54 ms 48148 KB Output is correct
20 Correct 85 ms 68192 KB Output is correct
21 Correct 70 ms 57160 KB Output is correct
22 Correct 56 ms 49480 KB Output is correct
23 Correct 53 ms 38196 KB Output is correct
24 Correct 110 ms 94492 KB Output is correct
25 Correct 110 ms 94272 KB Output is correct
26 Correct 119 ms 94612 KB Output is correct
27 Correct 111 ms 94404 KB Output is correct
28 Correct 111 ms 94644 KB Output is correct
29 Correct 1 ms 1360 KB Output is correct
30 Correct 1 ms 1360 KB Output is correct
31 Correct 23 ms 24692 KB Output is correct
32 Correct 117 ms 94024 KB Output is correct
33 Correct 48 ms 35788 KB Output is correct
34 Correct 18 ms 15568 KB Output is correct
35 Correct 1 ms 1360 KB Output is correct
36 Correct 57 ms 48264 KB Output is correct
37 Correct 24 ms 24784 KB Output is correct
38 Correct 23 ms 24784 KB Output is correct
39 Correct 39 ms 33984 KB Output is correct
40 Correct 48 ms 32764 KB Output is correct
41 Correct 29 ms 22184 KB Output is correct
42 Correct 3 ms 3152 KB Output is correct
43 Runtime error 2029 ms 2097152 KB Execution killed with signal 9
44 Halted 0 ms 0 KB -