답안 #1040471

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1040471 2024-08-01T05:35:39 Z 변재우(#10999) How to Avoid Disqualification in 75 Easy Steps (CEOI23_avoid) C++17
컴파일 오류
0 ms 0 KB
#include "avoid.h"
#include <vector>

std::pair<int, int> scout(int R, int H) {
  for(int i=0; i<10; i++) {
    vector<int> T;
    for(int j=1; j<=1000; j++) if(j&(1<<i)) T.push_back(j);
    send(T);
  }
  vector<int> T=wait();
  int ret=0;
  for(int i=0; i<10; i++) ret+=T[i]<<i;
  return {ret, ret};
}

Compilation message

avoid.cpp: In function 'std::pair<int, int> scout(int, int)':
avoid.cpp:6:5: error: 'vector' was not declared in this scope
    6 |     vector<int> T;
      |     ^~~~~~
avoid.cpp:6:5: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from avoid.h:1,
                 from avoid.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from avoid.h:1,
                 from avoid.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
avoid.cpp:6:12: error: expected primary-expression before 'int'
    6 |     vector<int> T;
      |            ^~~
avoid.cpp:7:45: error: 'T' was not declared in this scope
    7 |     for(int j=1; j<=1000; j++) if(j&(1<<i)) T.push_back(j);
      |                                             ^
avoid.cpp:8:10: error: 'T' was not declared in this scope
    8 |     send(T);
      |          ^
avoid.cpp:10:3: error: 'vector' was not declared in this scope
   10 |   vector<int> T=wait();
      |   ^~~~~~
avoid.cpp:10:3: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from avoid.h:1,
                 from avoid.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from avoid.h:1,
                 from avoid.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
avoid.cpp:10:10: error: expected primary-expression before 'int'
   10 |   vector<int> T=wait();
      |          ^~~
avoid.cpp:12:32: error: 'T' was not declared in this scope
   12 |   for(int i=0; i<10; i++) ret+=T[i]<<i;
      |                                ^