Submission #54653

#TimeUsernameProblemLanguageResultExecution timeMemory
54653gs18115Secret (JOI14_secret)C++14
Compilation error
0 ms0 KiB
#include"secret.h" #include<unordered_map> unordered_map<unsigned long long,bool>CHK; unordered_map<unsigned long long,int>SEC; int ST[4567]; int N2; int Secret2(int X,int Y) { unsigned long long P; P=X; P<<=32; P|=Y; if(CHK[P]) return SEC[P]; CHK[P]=true; return SEC[P]=Secret(X,Y); } void P(int I,int N) { ST[I]=N; if(I==1) return; if(I&1) P(I>>1,Secret2(ST[I^1],N)); else P(I>>1,Secret2(N,ST[I^1])); } int Q(int S,int F) { if(S==F) return ST[S]; else if(S==F-1) return Secret2(ST[S],ST[F]); int A; A=Q(S+1>>1,F-1>>1); if(S&1) A=Secret2(ST[S],A); if(!(F&1)) A=Secret2(A,ST[F]); return A; } void Init(int N,int A[]) { for(N2=1;N2<N;N2<<=1); for(int i=0;i<N;i++) P(i+N2,A[i]); int X; for(int i=0;i<N2>>1;i++) X=Q(i+N2,i+N2+(N2>>1)); return; } int Query(int L,int R) { return Q(L+N2,R+N2); }

Compilation message (stderr)

secret.cpp:3:1: error: 'unordered_map' does not name a type
 unordered_map<unsigned long long,bool>CHK;
 ^~~~~~~~~~~~~
secret.cpp:4:1: error: 'unordered_map' does not name a type
 unordered_map<unsigned long long,int>SEC;
 ^~~~~~~~~~~~~
secret.cpp: In function 'int Secret2(int, int)':
secret.cpp:13:8: error: 'CHK' was not declared in this scope
     if(CHK[P])
        ^~~
secret.cpp:14:16: error: 'SEC' was not declared in this scope
         return SEC[P];
                ^~~
secret.cpp:15:5: error: 'CHK' was not declared in this scope
     CHK[P]=true;
     ^~~
secret.cpp:16:12: error: 'SEC' was not declared in this scope
     return SEC[P]=Secret(X,Y);
            ^~~
secret.cpp: In function 'int Q(int, int)':
secret.cpp:35:10: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
     A=Q(S+1>>1,F-1>>1);
         ~^~
secret.cpp:35:17: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
     A=Q(S+1>>1,F-1>>1);
                ~^~