Submission #1128688

#TimeUsernameProblemLanguageResultExecution timeMemory
1128688rayan_bdRegions (IOI09_regions)C++20
0 / 100
145 ms196608 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize("Ofast") #pragma GCC optimize("inline") #pragma GCC optimize("-fgcse") #pragma GCC optimize("-fgcse-lm") #pragma GCC optimize("-fipa-sra") #pragma GCC optimize("-ftree-pre") #pragma GCC optimize("-ftree-vrp") #pragma GCC optimize("-fpeephole2") #pragma GCC optimize("-ffast-math") #pragma GCC optimize("-fsched-spec") #pragma GCC optimize("unroll-loops") #pragma GCC optimize("-falign-jumps") #pragma GCC optimize("-falign-loops") #pragma GCC optimize("-falign-labels") #pragma GCC optimize("-fdevirtualize") #pragma GCC optimize("-fcaller-saves") #pragma GCC optimize("-fcrossjumping") #pragma GCC optimize("-fthread-jumps") #pragma GCC optimize("-funroll-loops") #pragma GCC optimize("-fwhole-program") #pragma GCC optimize("-freorder-blocks") #pragma GCC optimize("-fschedule-insns") #pragma GCC optimize("inline-functions") #pragma GCC optimize("-ftree-tail-merge") #pragma GCC optimize("-fschedule-insns2") #pragma GCC optimize("-fstrict-aliasing") #pragma GCC optimize("-fstrict-overflow") #pragma GCC optimize("-falign-functions") #pragma GCC optimize("-fcse-skip-blocks") #pragma GCC optimize("-fcse-follow-jumps") #pragma GCC optimize("-fsched-interblock") #pragma GCC optimize("-fpartial-inlining") #pragma GCC optimize("no-stack-protector") #pragma GCC optimize("-freorder-functions") #pragma GCC optimize("-findirect-inlining") #pragma GCC optimize("-fhoist-adjacent-loads") #pragma GCC optimize("-frerun-cse-after-loop") #pragma GCC optimize("inline-small-functions") #pragma GCC optimize("-finline-small-functions") #pragma GCC optimize("-ftree-switch-conversion") #pragma GCC optimize("-foptimize-sibling-calls") #pragma GCC optimize("-fexpensive-optimizations") #pragma GCC optimize("-funsafe-loop-optimizations") #pragma GCC optimize("inline-functions-called-once") #pragma GCC optimize("-fdelete-null-pointer-checks") #define pb push_back #define fi first #define se second #define all(x) x.begin(),x.end() const int mxN = 2e5+5000; void io(){ /* #ifndef ONLINE_JUDGE freopen("input.in","r",stdin); freopen("output.out","w",stdout); #endif*/ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } vector<int> adj[mxN]; int dp[mxN][505],answers[505][505]; void dfs(int u){ for(auto it:adj[u]){ dfs(it); for(int i=1;i<=500;++i){ dp[u][i]+=dp[it][i]; } } } int main(){ io(); memset(dp,0,sizeof(dp)); int n,r,q,u,man,reg;cin>>n>>r>>q; cin>>u; ++dp[1][u]; dp[1][0]=u; for(int i=2;i<=n;++i){ cin>>u>>man; adj[u].pb(i); ++dp[i][man]; dp[i][0]=man; } dfs(1); for(int i=1;i<=n;++i){ for(int j=1;j<=r;++j){ answers[dp[i][0]][j]+=dp[i][j]; } } while(q--){ cin>>man>>reg; cout<<answers[man][reg]<<endl; } return 0; }

Compilation message (stderr)

regions.cpp:25:39: warning: bad option '-fwhole-program' to pragma 'optimize' [-Wpragmas]
   25 | #pragma GCC optimize("-fwhole-program")
      |                                       ^
regions.cpp:32:41: warning: bad option '-fstrict-overflow' to pragma 'optimize' [-Wpragmas]
   32 | #pragma GCC optimize("-fstrict-overflow")
      |                                         ^
regions.cpp:34:41: warning: bad option '-fcse-skip-blocks' to pragma 'optimize' [-Wpragmas]
   34 | #pragma GCC optimize("-fcse-skip-blocks")
      |                                         ^
regions.cpp:48:51: warning: bad option '-funsafe-loop-optimizations' to pragma 'optimize' [-Wpragmas]
   48 | #pragma GCC optimize("-funsafe-loop-optimizations")
      |                                                   ^
regions.cpp:59:9: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
   59 | void io(){
      |         ^
regions.cpp:59:9: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
regions.cpp:59:9: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
regions.cpp:59:9: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
regions.cpp:73:15: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
   73 | void dfs(int u){
      |               ^
regions.cpp:73:15: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
regions.cpp:73:15: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
regions.cpp:73:15: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
regions.cpp:83:10: warning: bad option '-fwhole-program' to attribute 'optimize' [-Wattributes]
   83 | int main(){
      |          ^
regions.cpp:83:10: warning: bad option '-fstrict-overflow' to attribute 'optimize' [-Wattributes]
regions.cpp:83:10: warning: bad option '-fcse-skip-blocks' to attribute 'optimize' [-Wattributes]
regions.cpp:83:10: warning: bad option '-funsafe-loop-optimizations' to attribute 'optimize' [-Wattributes]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...