Submission #749017

#TimeUsernameProblemLanguageResultExecution timeMemory
749017mariowongSecret (JOI14_secret)C++14
Compilation error
0 ms0 KiB
#include "secret.h" map <pair<int,int>,pair<int,bool> > m; void ask(int l,int r,int A[]){ int mid=(l+r)/2; if (l != r){ ask(l,mid); ask(mid+1,r); } int val=A[r]; for (int i=r-1;i>=l;i--){ if (!m[{i,r}].second){ val=Secret(A[i],r); m[{i,r}]={val,true}; } } } void Init(int N, int A[]) { m.clear(); int mid=(N-1)/2; for (int i=0;i<N;i++) m[{i,i}]={A[i],true}; ask(0,mid,A); ask(mid+1,N-1,A); } int Query(int L, int R) { if (m[{L,R}].second) return m[{L,R}].first; for (int i=L;i<R;i++){ if (m[{L,i}].second && m[{i+1,R}].second) return Secret(m[{L,i}].first,m[{i+1,R}].first); } return 0; }

Compilation message (stderr)

secret.cpp:3:1: error: 'map' does not name a type
    3 | map <pair<int,int>,pair<int,bool>  > m;
      | ^~~
secret.cpp: In function 'void ask(int, int, int*)':
secret.cpp:7:12: error: too few arguments to function 'void ask(int, int, int*)'
    7 |   ask(l,mid);
      |            ^
secret.cpp:4:6: note: declared here
    4 | void ask(int l,int r,int A[]){
      |      ^~~
secret.cpp:8:14: error: too few arguments to function 'void ask(int, int, int*)'
    8 |   ask(mid+1,r);
      |              ^
secret.cpp:4:6: note: declared here
    4 | void ask(int l,int r,int A[]){
      |      ^~~
secret.cpp:12:8: error: 'm' was not declared in this scope
   12 |   if (!m[{i,r}].second){
      |        ^
secret.cpp: In function 'void Init(int, int*)':
secret.cpp:20:4: error: 'm' was not declared in this scope
   20 |    m.clear();
      |    ^
secret.cpp: In function 'int Query(int, int)':
secret.cpp:28:6: error: 'm' was not declared in this scope
   28 |  if (m[{L,R}].second) return m[{L,R}].first;
      |      ^
secret.cpp:30:7: error: 'm' was not declared in this scope
   30 |   if (m[{L,i}].second && m[{i+1,R}].second) return Secret(m[{L,i}].first,m[{i+1,R}].first);
      |       ^