제출 #1223127

#제출 시각아이디문제언어결과실행 시간메모리
1223127spetrHow to Avoid Disqualification in 75 Easy Steps (CEOI23_avoid)C++20
컴파일 에러
0 ms0 KiB
#include "avoid.h"
#include <vector>

std::pair<int, int> scout(int R, int H) {

    int velikost = 1;
    vector<vector<int>> v;
    for (int i = 0; i < 1000; i++){
        v.push_back({});
    }
    for (int i = 0; i < R; i++){
        vector<int> pole;
        for (int j = 1; j <= 1000; j+= 2*velikost){
            for (int k = j; k < j+velikost; k++){
                pole.push_back(k);
                v.push_back(i);
            }
        }
        send(pole);
    }
    auto p = wait();
    for (int i = 0; i < 1000; i++){
        bool ok = true;
        for (int j = 0; v[i].size(); j++){
            if (p[v[i][j]] == 0){
                ok = false;
                break;
            } 
        }
        if (ok){
            return {i+1,i+1};
        }
    }




  
}

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

avoid.cpp: In function 'std::pair<int, int> scout(int, int)':
avoid.cpp:7:12: error: 'vector' was not declared in this scope
    7 |     vector<vector<int>> v;
      |            ^~~~~~
avoid.cpp:7:12: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:67,
                 from avoid.h:1,
                 from avoid.cpp:1:
/usr/include/c++/11/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++/11/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
avoid.cpp:7:19: error: expected primary-expression before 'int'
    7 |     vector<vector<int>> v;
      |                   ^~~
avoid.cpp:9:9: error: 'v' was not declared in this scope
    9 |         v.push_back({});
      |         ^
avoid.cpp:12:16: error: expected primary-expression before 'int'
   12 |         vector<int> pole;
      |                ^~~
avoid.cpp:15:17: error: 'pole' was not declared in this scope
   15 |                 pole.push_back(k);
      |                 ^~~~
avoid.cpp:16:17: error: 'v' was not declared in this scope
   16 |                 v.push_back(i);
      |                 ^
avoid.cpp:19:14: error: 'pole' was not declared in this scope
   19 |         send(pole);
      |              ^~~~
avoid.cpp:24:25: error: 'v' was not declared in this scope
   24 |         for (int j = 0; v[i].size(); j++){
      |                         ^
avoid.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
   39 | }
      | ^