Submission #777353

# Submission time Handle Problem Language Result Execution time Memory
777353 2023-07-09T06:36:38 Z ETO_leader Regions (IOI09_regions) C++17
0 / 100
78 ms 29952 KB
#include<bits/stdc++.h>
#define cir(i,a,b) for(int i=a;i<b;++i)
using namespace std;
using lint=long long;
using VI=vector<int>;
using VL=vector<lint>;
vector<VI> G;vector<VL> cx;
VI tin,tout,w,col;
void dfs(int u,int&cnx,int f=0){
    tin[u]=cnx++;
    for(auto&i:G[u]) if(i!=f) dfs(i,cnx,u);
    tout[u]=cnx;
}
bool isancestor(int u,int v){
    return tin[u]<=tin[v]&&tout[v]<=tout[u];
}
void dfsx(int u,int ci,int wx=0,int f=0){
    w[u]=(wx+=(col[u]==ci));
    for(auto&i:G[u]) if(i!=f) dfsx(i,ci,wx,u);
}
void init(int n){
    G.resize(n+1);tin.resize(n+1);col.resize(n+1);
    tout.resize(n+1);w.resize(n+1);
}
int main(){
    ios::sync_with_stdio(false),cin.tie(0);
    int n,r,q;cin>>n>>r>>q;init(n);
    const int sqr=pow<double>(n,3.0/1.0)+1;
    VL cnx(r+1),idx(n+1);
    vector<VI> ci(r+1);
    cin>>col[1];cnx[col[1]]++;ci[col[1]].push_back(1);
    cir(i,2,n+1){
        int f;cin>>f>>col[i];cnx[col[i]]++;
        G[f].push_back(i);G[i].push_back(f);
        ci[col[i]].push_back(i);
    }
    [&](){int ncnx=0;dfs(1,ncnx);}();
    return 0;
}

Compilation message

regions.cpp: In function 'int main()':
regions.cpp:28:15: warning: unused variable 'sqr' [-Wunused-variable]
   28 |     const int sqr=pow<double>(n,3.0/1.0)+1;
      |               ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 208 KB Unexpected end of file - int32 expected
2 Incorrect 0 ms 208 KB Unexpected end of file - int32 expected
3 Incorrect 0 ms 208 KB Unexpected end of file - int32 expected
4 Incorrect 0 ms 208 KB Unexpected end of file - int32 expected
5 Incorrect 0 ms 336 KB Unexpected end of file - int32 expected
6 Incorrect 1 ms 336 KB Unexpected end of file - int32 expected
7 Incorrect 1 ms 336 KB Unexpected end of file - int32 expected
8 Incorrect 1 ms 464 KB Unexpected end of file - int32 expected
9 Incorrect 1 ms 976 KB Unexpected end of file - int32 expected
10 Incorrect 2 ms 1104 KB Unexpected end of file - int32 expected
11 Incorrect 4 ms 1616 KB Unexpected end of file - int32 expected
12 Incorrect 5 ms 2256 KB Unexpected end of file - int32 expected
13 Incorrect 6 ms 2324 KB Unexpected end of file - int32 expected
14 Incorrect 7 ms 2896 KB Unexpected end of file - int32 expected
15 Incorrect 9 ms 6224 KB Unexpected end of file - int32 expected
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 7512 KB Unexpected end of file - int32 expected
2 Incorrect 20 ms 7212 KB Unexpected end of file - int32 expected
3 Incorrect 27 ms 9928 KB Unexpected end of file - int32 expected
4 Incorrect 7 ms 3152 KB Unexpected end of file - int32 expected
5 Incorrect 9 ms 5200 KB Unexpected end of file - int32 expected
6 Incorrect 13 ms 5328 KB Unexpected end of file - int32 expected
7 Incorrect 18 ms 6868 KB Unexpected end of file - int32 expected
8 Incorrect 24 ms 13392 KB Unexpected end of file - int32 expected
9 Incorrect 54 ms 14888 KB Unexpected end of file - int32 expected
10 Incorrect 45 ms 21360 KB Unexpected end of file - int32 expected
11 Incorrect 54 ms 18720 KB Unexpected end of file - int32 expected
12 Incorrect 78 ms 17064 KB Unexpected end of file - int32 expected
13 Incorrect 56 ms 18104 KB Unexpected end of file - int32 expected
14 Incorrect 75 ms 18388 KB Unexpected end of file - int32 expected
15 Incorrect 57 ms 22548 KB Unexpected end of file - int32 expected
16 Incorrect 56 ms 29952 KB Unexpected end of file - int32 expected
17 Incorrect 56 ms 28340 KB Unexpected end of file - int32 expected