제출 #67356

#제출 시각아이디문제언어결과실행 시간메모리
67356zetapi앵무새 (IOI11_parrots)C++14
컴파일 에러
0 ms0 KiB
#include "encoder.h" #include "encoderlib.h" void encode(int N,int M[]) { int arr[1000]; vector<int> vec; for(int A=0;A<N;A++) { send(-M[A]); vec.pb(mp(M[A],A)); } sort(vec.begin(),vec.end()); for(int A=0;A<vec.size();A++) arr[vec[A].second]=A; for(int A=0;A<N;A++) { int res=A; for(int B=0;B<8;B++) { if(arr[A]&(1<<B)) res+=1<<(B+4); } send(res); } return ; }
#include "decoder.h" #include "decoderlib.h" void decode(int N, int L, int X[]) { int res[1000]; vector<int> vec; for(int A=0;A<L;A++) if(X[A]<0) vec.pb(-X[A]); sort(vec.begin(),vec.end()); for(int A=0;A<L;A++) { if(X[A]<0) continue; int ind=0,num=0; for(int B=0;B<4;B++) if(X[A+N]&(1<<B)) ind+=(1<<B); for(int B=0;B<8;B++) if(X[A+N]&(1<<(B+4))) num+=(1<<B); res[ind]=num; } for(int A=0;A<N;A++) output(vec[res[A]]); return ; }

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

encoder.cpp: In function 'void encode(int, int*)':
encoder.cpp:7:2: error: 'vector' was not declared in this scope
  vector<int> vec;
  ^~~~~~
encoder.cpp:7:9: error: expected primary-expression before 'int'
  vector<int> vec;
         ^~~
encoder.cpp:11:3: error: 'vec' was not declared in this scope
   vec.pb(mp(M[A],A));
   ^~~
encoder.cpp:11:10: error: 'mp' was not declared in this scope
   vec.pb(mp(M[A],A));
          ^~
encoder.cpp:13:7: error: 'vec' was not declared in this scope
  sort(vec.begin(),vec.end());
       ^~~
encoder.cpp:13:2: error: 'sort' was not declared in this scope
  sort(vec.begin(),vec.end());
  ^~~~
encoder.cpp:13:2: note: suggested alternative: 'short'
  sort(vec.begin(),vec.end());
  ^~~~
  short

decoder.cpp: In function 'void decode(int, int, int*)':
decoder.cpp:7:2: error: 'vector' was not declared in this scope
  vector<int> vec;
  ^~~~~~
decoder.cpp:7:9: error: expected primary-expression before 'int'
  vector<int> vec;
         ^~~
decoder.cpp:10:6: error: 'vec' was not declared in this scope
      vec.pb(-X[A]);
      ^~~
decoder.cpp:11:9: error: 'vec' was not declared in this scope
    sort(vec.begin(),vec.end());
         ^~~
decoder.cpp:11:4: error: 'sort' was not declared in this scope
    sort(vec.begin(),vec.end());
    ^~~~
decoder.cpp:11:4: note: suggested alternative: 'short'
    sort(vec.begin(),vec.end());
    ^~~~
    short