답안 #576559

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
576559 2022-06-13T07:52:41 Z jiahng Art Collections (BOI22_art) C++17
컴파일 오류
0 ms 0 KB
typedef vector <pii> vpii;

void solve(int N) {
        vi v;
        FOR(i,1,N) v.pb(i);
        sort(all(v), [](int i,int j){
                vi v1, v2;
                FOR(k,1,N) if (k != i && k != j){
                        v1.pb(k); v2.pb(k);
                }
                v1.pb(i); v1.pb(j);
                v2.pb(j); v2.pb(i);
                return publish(v1) < publish(v2);
        });
        answer(v);
}

Compilation message

art.cpp:1:9: error: 'vector' does not name a type
    1 | typedef vector <pii> vpii;
      |         ^~~~~~
art.cpp: In function 'void solve(int)':
art.cpp:4:9: error: 'vi' was not declared in this scope
    4 |         vi v;
      |         ^~
art.cpp:5:13: error: 'i' was not declared in this scope
    5 |         FOR(i,1,N) v.pb(i);
      |             ^
art.cpp:5:9: error: 'FOR' was not declared in this scope
    5 |         FOR(i,1,N) v.pb(i);
      |         ^~~
art.cpp:6:18: error: 'v' was not declared in this scope
    6 |         sort(all(v), [](int i,int j){
      |                  ^
art.cpp:6:14: error: 'all' was not declared in this scope
    6 |         sort(all(v), [](int i,int j){
      |              ^~~
art.cpp: In lambda function:
art.cpp:7:17: error: 'vi' is not captured
    7 |                 vi v1, v2;
      |                 ^~
art.cpp:6:23: note: the lambda has no capture-default
    6 |         sort(all(v), [](int i,int j){
      |                       ^
art.cpp:4:9: note: '<typeprefixerror>vi' declared here
    4 |         vi v;
      |         ^~
art.cpp:8:17: error: 'FOR' is not captured
    8 |                 FOR(k,1,N) if (k != i && k != j){
      |                 ^~~
art.cpp:6:23: note: the lambda has no capture-default
    6 |         sort(all(v), [](int i,int j){
      |                       ^
art.cpp:5:9: note: '<typeprefixerror>FOR' declared here
    5 |         FOR(i,1,N) v.pb(i);
      |         ^~~
art.cpp:8:21: error: 'k' was not declared in this scope
    8 |                 FOR(k,1,N) if (k != i && k != j){
      |                     ^
art.cpp:8:25: error: 'N' is not captured
    8 |                 FOR(k,1,N) if (k != i && k != j){
      |                         ^
art.cpp:6:23: note: the lambda has no capture-default
    6 |         sort(all(v), [](int i,int j){
      |                       ^
art.cpp:3:16: note: 'int N' declared here
    3 | void solve(int N) {
      |            ~~~~^
art.cpp:11:17: error: 'v1' was not declared in this scope
   11 |                 v1.pb(i); v1.pb(j);
      |                 ^~
art.cpp:12:17: error: 'v2' was not declared in this scope
   12 |                 v2.pb(j); v2.pb(i);
      |                 ^~
art.cpp:13:24: error: 'publish' was not declared in this scope
   13 |                 return publish(v1) < publish(v2);
      |                        ^~~~~~~
art.cpp: In function 'void solve(int)':
art.cpp:6:9: error: 'sort' was not declared in this scope; did you mean 'short'?
    6 |         sort(all(v), [](int i,int j){
      |         ^~~~
      |         short
art.cpp:15:9: error: 'answer' was not declared in this scope
   15 |         answer(v);
      |         ^~~~~~
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~