제출 #54639

#제출 시각아이디문제언어결과실행 시간메모리
54639gs18115비밀 (JOI14_secret)C++14
컴파일 에러
0 ms0 KiB
#include"string.h" #include<map> using namespace std; map<pair<int,int>,bool>CHK; map<pair<int,int>,int>SEC; int ST[4567]; int N2; int Secret2(int X,int Y) { pair<int,int>P; P=make_pair(X,Y); if(CHK[P]) return SEC[P]; CHK[P]=true; return SEC[P]=Secret(X,Y); } void P(int I,int N) { if(!I)return; ST[I]=N; 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 0; 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(i=0;i<N;i++) P(i+N2,A[i]); } int Query(int L,int R) { return Q(L+N2,R+N2); }

컴파일 시 표준 에러 (stderr) 메시지

secret.cpp: In function 'int Secret2(int, int)':
secret.cpp:15:19: error: 'Secret' was not declared in this scope
     return SEC[P]=Secret(X,Y);
                   ^~~~~~
secret.cpp:15:19: note: suggested alternative: 'Secret2'
     return SEC[P]=Secret(X,Y);
                   ^~~~~~
                   Secret2
secret.cpp: In function 'int Q(int, int)':
secret.cpp:30:10: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
     A=Q(S+1>>1,F-1>>1);
         ~^~
secret.cpp:30:17: warning: suggest parentheses around '-' inside '>>' [-Wparentheses]
     A=Q(S+1>>1,F-1>>1);
                ~^~
secret.cpp: In function 'void Init(int, int*)':
secret.cpp:40:9: error: 'i' was not declared in this scope
     for(i=0;i<N;i++)
         ^