# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
639359 | CSQ31 | Digital Circuit (IOI22_circuit) | C++17 | 1053 ms | 14064 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "circuit.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll MOD = 1000002022;
const int MAXN = 1e5+5;
vector<int>adj[MAXN];
ll c[MAXN],sub[MAXN];
int n,m;
void dfs(int v){
if(adj[v].empty())sub[v] = 1;
else sub[v] = adj[v].size();
for(int x:adj[v]){
dfs(x);
sub[v] = sub[v]*sub[x]%MOD;
}
}
void dfs(int v,ll cur){
if(adj[v].empty()){
c[v-n] = cur;
return;
}
int s = adj[v].size();
vector<ll>pref(s,1),suff(s,1);
for(int i=0;i<s;i++){
pref[i] = sub[adj[v][i]];
suff[i] = sub[adj[v][i]];
if(i)pref[i] = pref[i]*pref[i-1]%MOD;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |