Submission #639359

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6393592022-09-09 16:18:22CSQ31Digital Circuit (IOI22_circuit)C++17
46 / 100
1053 ms14064 KiB
#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;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...