Submission #627509

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
6275092022-08-12 15:58:42KaitokidDigital Circuit (IOI22_circuit)C++17
100 / 100
1130 ms25448 KiB
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int mod=1000002022;
vector<int>ch[200009];
int sz[200009], f[200009],n,m;
void dfs(int x)
{
if(ch[x].empty()){sz[x]=1;return;}
sz[x]=ch[x].size();
for(int i=0;i<ch[x].size();i++){dfs(ch[x][i]);sz[x]=(sz[x]*1LL*sz[ch[x][i]])%mod;}
// cout<<55<<" "<<x<<" "<<sz[x]<<endl;
}
void go(int x,int prd)
{
//cout<<66<<" "<<x<<" "<<prd<<endl;
if(ch[x].empty()){f[x-n]=prd;return;}
int w=ch[x].size();
vector<int>suf(w+1);
suf[w]=1;
for(int i=w-1;i>=0;i--)suf[i]=(suf[i+1]*1LL*sz[ch[x][i]])%mod;
int d=1;
for(int i=0;i<w;i++)
{
int r=(d*1LL*suf[i+1])%mod;
go(ch[x][i],(r*1LL*prd)%mod);
d=(d*1LL*sz[ch[x][i]])%mod;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

circuit.cpp: In function 'void dfs(int)':
circuit.cpp:11:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for(int i=0;i<ch[x].size();i++){dfs(ch[x][i]);sz[x]=(sz[x]*1LL*sz[ch[x][i]])%mod;}
      |                 ~^~~~~~~~~~~~~
#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...