답안 #909372

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
909372 2024-01-17T07:36:39 Z MinhAnhnd Coreputer (IOI23_coreputer) C++17
컴파일 오류
0 ms 0 KB
#include "coreputer.h"

std::vector<int> malfunctioning_cores(int N) {

    vector<int> a;
    for (int i = 0;i<=min(7,N-1);i++){
        a.push_back(i);
    }
    half = run_diagnostic(a);
    vector<int> b;
    for (int i = 0;i<=N-1;i++){
        b.push_back(1);
    }
	return b;
}

Compilation message

coreputer.cpp: In function 'std::vector<int> malfunctioning_cores(int)':
coreputer.cpp:5:5: error: 'vector' was not declared in this scope
    5 |     vector<int> a;
      |     ^~~~~~
coreputer.cpp:5:5: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from coreputer.h:1,
                 from coreputer.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 coreputer.h:1,
                 from coreputer.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
coreputer.cpp:5:12: error: expected primary-expression before 'int'
    5 |     vector<int> a;
      |            ^~~
coreputer.cpp:6:23: error: 'min' was not declared in this scope; did you mean 'std::min'?
    6 |     for (int i = 0;i<=min(7,N-1);i++){
      |                       ^~~
      |                       std::min
In file included from /usr/include/c++/10/vector:60,
                 from coreputer.h:1,
                 from coreputer.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:278:5: note: 'std::min' declared here
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
coreputer.cpp:7:9: error: 'a' was not declared in this scope
    7 |         a.push_back(i);
      |         ^
coreputer.cpp:9:5: error: 'half' was not declared in this scope
    9 |     half = run_diagnostic(a);
      |     ^~~~
coreputer.cpp:9:27: error: 'a' was not declared in this scope
    9 |     half = run_diagnostic(a);
      |                           ^
coreputer.cpp:10:12: error: expected primary-expression before 'int'
   10 |     vector<int> b;
      |            ^~~
coreputer.cpp:12:9: error: 'b' was not declared in this scope
   12 |         b.push_back(1);
      |         ^
coreputer.cpp:14:9: error: 'b' was not declared in this scope
   14 |  return b;
      |         ^