# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
995376 | 2024-06-09T01:02:15 Z | aaaaaarroz | Digital Circuit (IOI22_circuit) | C++17 | 3000 ms | 4160 KB |
#include <bits/stdc++.h> using namespace std; vector<vector<int>>graph; vector<int>max_parameter; vector<int>ways; vector<int>state; int n,m; void dfs1(int nodo){ if(nodo>=n){ return; } for(int vecino:graph[nodo]){ dfs1(vecino); if(vecino<n){ max_parameter[nodo]+=(max_parameter[vecino]>=1); } else{ max_parameter[nodo]+=(state[vecino-n]==1); } } } void dfs2(int nodo){ if(nodo<n){ ways[nodo]=max_parameter[nodo]; } for(int vecino:graph[nodo]){ dfs2(vecino); ways[nodo]*=ways[vecino]; } } void init(int N, int M, vector<int> P, vector<int> A) { n=N; m=M; graph.resize(N+M,vector<int>()); state=A; max_parameter.resize(N); ways.resize(N+M); for(int i=0;i<P.size();i++){ if(P[i]!=-1){ graph[P[i]].push_back(i); } } } int count_ways(int L, int R) { for(int i=L;i<=R;i++){ state[i-n]^=1; } dfs1(0); ways.resize(n+m,1); dfs2(0); return ways[0]; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3038 ms | 4160 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 3038 ms | 4160 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | 1st lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |