# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
910914 | 2024-01-18T09:22:57 Z | tnun | 디지털 회로 (IOI22_circuit) | C++17 | 3000 ms | 10060 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back int N,M; vector<int> P; vector<int> A; ll int mod=1000002022; vector<int> adj[200050]; ll int one[200050]={0}; ll int zer[200050]={0}; void dfs(){ for(int node=N+M-1;node>=0;node--){ if(node>=N){ if(A[node-N]==1){ one[node]=1; zer[node]=0; }else{ one[node]=0; zer[node]=1; } continue; } ll int all=1; for(int i=0;i<adj[node].size();i++){ all*=(one[adj[node][i]]+zer[adj[node][i]]); all=all%mod; } for(int i=0;i<adj[node].size();i++){ ll int all_1=1; for(int o=0;o<adj[node].size();o++){ if(o!=i){ all_1*=(one[adj[node][o]]+zer[adj[node][o]]); all_1=all_1%mod; } } one[node]+=(one[adj[node][i]])*all_1; one[node]=one[node]%mod; } all=all*adj[node].size(); all=all%mod; zer[node]=all-one[node]; } } int count_ways(int l,int r){ memset(one, 0, sizeof(one)); memset(zer, 0, sizeof(zer)); for(int i=l;i<=r;i++){ A[i-N]=(A[i-N]+1)%2; } // for(int i=0;i<A.size();i++){ // cout<<A[i]<<" "; // } // cout<<endl; dfs(); // for(int i=0;i<N+M;i++){ // cout<<i<<" "<<one[i]<<" "<<zer[i]<<endl; // } return one[0]; } void init(int n,int m, vector<int> p,vector<int> a){ N=n; M=m; for(int i=0;i<p.size();i++){ P.pb(p[i]); } for(int i=0;i<a.size();i++){ A.pb(a[i]); } for(int i=1;i<N+M;i++){ adj[P[i]].pb(i); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 8180 KB | Output is correct |
2 | Correct | 3 ms | 8024 KB | Output is correct |
3 | Correct | 24 ms | 8292 KB | Output is correct |
4 | Correct | 25 ms | 8280 KB | Output is correct |
5 | Correct | 24 ms | 8280 KB | Output is correct |
6 | Correct | 26 ms | 8280 KB | Output is correct |
7 | Correct | 25 ms | 8284 KB | Output is correct |
8 | Correct | 25 ms | 8280 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 8024 KB | Output is correct |
2 | Correct | 3 ms | 8280 KB | Output is correct |
3 | Correct | 3 ms | 8280 KB | Output is correct |
4 | Correct | 3 ms | 8280 KB | Output is correct |
5 | Correct | 3 ms | 8280 KB | Output is correct |
6 | Correct | 3 ms | 8280 KB | Output is correct |
7 | Correct | 4 ms | 8280 KB | Output is correct |
8 | Correct | 4 ms | 8280 KB | Output is correct |
9 | Correct | 3 ms | 8280 KB | Output is correct |
10 | Correct | 3 ms | 8280 KB | Output is correct |
11 | Correct | 3 ms | 8280 KB | Output is correct |
12 | Correct | 3 ms | 8280 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 8180 KB | Output is correct |
2 | Correct | 3 ms | 8024 KB | Output is correct |
3 | Correct | 24 ms | 8292 KB | Output is correct |
4 | Correct | 25 ms | 8280 KB | Output is correct |
5 | Correct | 24 ms | 8280 KB | Output is correct |
6 | Correct | 26 ms | 8280 KB | Output is correct |
7 | Correct | 25 ms | 8284 KB | Output is correct |
8 | Correct | 25 ms | 8280 KB | Output is correct |
9 | Correct | 3 ms | 8024 KB | Output is correct |
10 | Correct | 3 ms | 8280 KB | Output is correct |
11 | Correct | 3 ms | 8280 KB | Output is correct |
12 | Correct | 3 ms | 8280 KB | Output is correct |
13 | Correct | 3 ms | 8280 KB | Output is correct |
14 | Correct | 3 ms | 8280 KB | Output is correct |
15 | Correct | 4 ms | 8280 KB | Output is correct |
16 | Correct | 4 ms | 8280 KB | Output is correct |
17 | Correct | 3 ms | 8280 KB | Output is correct |
18 | Correct | 3 ms | 8280 KB | Output is correct |
19 | Correct | 3 ms | 8280 KB | Output is correct |
20 | Correct | 3 ms | 8280 KB | Output is correct |
21 | Correct | 4 ms | 8280 KB | Output is correct |
22 | Correct | 3 ms | 8280 KB | Output is correct |
23 | Correct | 3 ms | 8280 KB | Output is correct |
24 | Correct | 3 ms | 8280 KB | Output is correct |
25 | Correct | 3 ms | 8280 KB | Output is correct |
26 | Correct | 3 ms | 8280 KB | Output is correct |
27 | Correct | 3 ms | 8280 KB | Output is correct |
28 | Correct | 4 ms | 8280 KB | Output is correct |
29 | Correct | 24 ms | 8280 KB | Output is correct |
30 | Correct | 25 ms | 8280 KB | Output is correct |
31 | Correct | 3 ms | 8280 KB | Output is correct |
32 | Correct | 3 ms | 8280 KB | Output is correct |
33 | Correct | 3 ms | 8280 KB | Output is correct |
34 | Correct | 4 ms | 8280 KB | Output is correct |
35 | Correct | 7 ms | 8280 KB | Output is correct |
36 | Correct | 3 ms | 8280 KB | Output is correct |
37 | Correct | 25 ms | 8280 KB | Output is correct |
38 | Correct | 25 ms | 8280 KB | Output is correct |
39 | Correct | 4 ms | 8280 KB | Output is correct |
40 | Correct | 3 ms | 8280 KB | Output is correct |
41 | Correct | 3 ms | 8280 KB | Output is correct |
42 | Correct | 4 ms | 8280 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3072 ms | 10060 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3072 ms | 10060 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 8024 KB | Output is correct |
2 | Correct | 3 ms | 8280 KB | Output is correct |
3 | Correct | 3 ms | 8280 KB | Output is correct |
4 | Correct | 3 ms | 8280 KB | Output is correct |
5 | Correct | 3 ms | 8280 KB | Output is correct |
6 | Correct | 3 ms | 8280 KB | Output is correct |
7 | Correct | 4 ms | 8280 KB | Output is correct |
8 | Correct | 4 ms | 8280 KB | Output is correct |
9 | Correct | 3 ms | 8280 KB | Output is correct |
10 | Correct | 3 ms | 8280 KB | Output is correct |
11 | Correct | 3 ms | 8280 KB | Output is correct |
12 | Correct | 3 ms | 8280 KB | Output is correct |
13 | Execution timed out | 3072 ms | 10060 KB | Time limit exceeded |
14 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 8180 KB | Output is correct |
2 | Correct | 3 ms | 8024 KB | Output is correct |
3 | Correct | 24 ms | 8292 KB | Output is correct |
4 | Correct | 25 ms | 8280 KB | Output is correct |
5 | Correct | 24 ms | 8280 KB | Output is correct |
6 | Correct | 26 ms | 8280 KB | Output is correct |
7 | Correct | 25 ms | 8284 KB | Output is correct |
8 | Correct | 25 ms | 8280 KB | Output is correct |
9 | Correct | 3 ms | 8024 KB | Output is correct |
10 | Correct | 3 ms | 8280 KB | Output is correct |
11 | Correct | 3 ms | 8280 KB | Output is correct |
12 | Correct | 3 ms | 8280 KB | Output is correct |
13 | Correct | 3 ms | 8280 KB | Output is correct |
14 | Correct | 3 ms | 8280 KB | Output is correct |
15 | Correct | 4 ms | 8280 KB | Output is correct |
16 | Correct | 4 ms | 8280 KB | Output is correct |
17 | Correct | 3 ms | 8280 KB | Output is correct |
18 | Correct | 3 ms | 8280 KB | Output is correct |
19 | Correct | 3 ms | 8280 KB | Output is correct |
20 | Correct | 3 ms | 8280 KB | Output is correct |
21 | Correct | 4 ms | 8280 KB | Output is correct |
22 | Correct | 3 ms | 8280 KB | Output is correct |
23 | Correct | 3 ms | 8280 KB | Output is correct |
24 | Correct | 3 ms | 8280 KB | Output is correct |
25 | Correct | 3 ms | 8280 KB | Output is correct |
26 | Correct | 3 ms | 8280 KB | Output is correct |
27 | Correct | 3 ms | 8280 KB | Output is correct |
28 | Correct | 4 ms | 8280 KB | Output is correct |
29 | Correct | 24 ms | 8280 KB | Output is correct |
30 | Correct | 25 ms | 8280 KB | Output is correct |
31 | Correct | 3 ms | 8280 KB | Output is correct |
32 | Correct | 3 ms | 8280 KB | Output is correct |
33 | Correct | 3 ms | 8280 KB | Output is correct |
34 | Correct | 4 ms | 8280 KB | Output is correct |
35 | Correct | 7 ms | 8280 KB | Output is correct |
36 | Correct | 3 ms | 8280 KB | Output is correct |
37 | Correct | 25 ms | 8280 KB | Output is correct |
38 | Correct | 25 ms | 8280 KB | Output is correct |
39 | Correct | 4 ms | 8280 KB | Output is correct |
40 | Correct | 3 ms | 8280 KB | Output is correct |
41 | Correct | 3 ms | 8280 KB | Output is correct |
42 | Correct | 4 ms | 8280 KB | Output is correct |
43 | Execution timed out | 3020 ms | 8280 KB | Time limit exceeded |
44 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 8180 KB | Output is correct |
2 | Correct | 3 ms | 8024 KB | Output is correct |
3 | Correct | 24 ms | 8292 KB | Output is correct |
4 | Correct | 25 ms | 8280 KB | Output is correct |
5 | Correct | 24 ms | 8280 KB | Output is correct |
6 | Correct | 26 ms | 8280 KB | Output is correct |
7 | Correct | 25 ms | 8284 KB | Output is correct |
8 | Correct | 25 ms | 8280 KB | Output is correct |
9 | Correct | 3 ms | 8024 KB | Output is correct |
10 | Correct | 3 ms | 8280 KB | Output is correct |
11 | Correct | 3 ms | 8280 KB | Output is correct |
12 | Correct | 3 ms | 8280 KB | Output is correct |
13 | Correct | 3 ms | 8280 KB | Output is correct |
14 | Correct | 3 ms | 8280 KB | Output is correct |
15 | Correct | 4 ms | 8280 KB | Output is correct |
16 | Correct | 4 ms | 8280 KB | Output is correct |
17 | Correct | 3 ms | 8280 KB | Output is correct |
18 | Correct | 3 ms | 8280 KB | Output is correct |
19 | Correct | 3 ms | 8280 KB | Output is correct |
20 | Correct | 3 ms | 8280 KB | Output is correct |
21 | Correct | 4 ms | 8280 KB | Output is correct |
22 | Correct | 3 ms | 8280 KB | Output is correct |
23 | Correct | 3 ms | 8280 KB | Output is correct |
24 | Correct | 3 ms | 8280 KB | Output is correct |
25 | Correct | 3 ms | 8280 KB | Output is correct |
26 | Correct | 3 ms | 8280 KB | Output is correct |
27 | Correct | 3 ms | 8280 KB | Output is correct |
28 | Correct | 4 ms | 8280 KB | Output is correct |
29 | Correct | 24 ms | 8280 KB | Output is correct |
30 | Correct | 25 ms | 8280 KB | Output is correct |
31 | Correct | 3 ms | 8280 KB | Output is correct |
32 | Correct | 3 ms | 8280 KB | Output is correct |
33 | Correct | 3 ms | 8280 KB | Output is correct |
34 | Correct | 4 ms | 8280 KB | Output is correct |
35 | Correct | 7 ms | 8280 KB | Output is correct |
36 | Correct | 3 ms | 8280 KB | Output is correct |
37 | Correct | 25 ms | 8280 KB | Output is correct |
38 | Correct | 25 ms | 8280 KB | Output is correct |
39 | Correct | 4 ms | 8280 KB | Output is correct |
40 | Correct | 3 ms | 8280 KB | Output is correct |
41 | Correct | 3 ms | 8280 KB | Output is correct |
42 | Correct | 4 ms | 8280 KB | Output is correct |
43 | Execution timed out | 3072 ms | 10060 KB | Time limit exceeded |
44 | Halted | 0 ms | 0 KB | - |