#include <vector>
#include<bits/stdc++.h>
#include "circuit.h"
using namespace std;
#define vi vector<int>
#define vii vector<vi>
#define ll long long
#define vl vector<ll>
int n,m;
vii g;
vl ways;
int mod=1000002022;
void init(int N, int M, std::vector<int> P, std::vector<int> A) {
n=N;
m=M;
g.resize(N+M);
ways.resize(M+N);
for(int i=1 ;i<N+M;i++){
g[P[i]].push_back(i);
}
for(int i=N;i<N+M;i++){
ways[i]=A[i-N];
}
}
void dfs(int node){
if(g[node].size()==0)return;
ways[node]=2*ways[g[node][0]]*ways[g[node][1]]+ways[g[node][1]]+ways[g[node][0]];
ways[node]%=mod;
}
int count_ways(int L, int R) {
for(int i=L;i<=R;i++){
ways[i]=!ways[i];
}
dfs(0);
return ways[0];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
2nd lines differ - on the 1st token, expected: '2', found: '4' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
2nd lines differ - on the 1st token, expected: '2', found: '4' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
2nd lines differ - on the 1st token, expected: '2', found: '4' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
248 ms |
4148 KB |
1st lines differ - on the 1st token, expected: '431985922', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
248 ms |
4148 KB |
1st lines differ - on the 1st token, expected: '431985922', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
2nd lines differ - on the 1st token, expected: '2', found: '4' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
2nd lines differ - on the 1st token, expected: '2', found: '4' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
2nd lines differ - on the 1st token, expected: '2', found: '4' |
2 |
Halted |
0 ms |
0 KB |
- |