제출 #305387

#제출 시각아이디문제언어결과실행 시간메모리
305387JooDdae카니발 티켓 (IOI20_tickets)C++17
컴파일 에러
0 ms0 KiB
long long find_maximum(int k, std::vector<std::vector<int>> x) { int n = x.size(); int m = x[0].size(); vector<vector<int>> v(n, vector<int>(m)); allocate_tickets(v); vector<int> v2; for(int i=0;i<n;i++) v2.push_back(x[i][0]); ll ans = 0; for(int i=0;i<n/2;i++) ans -= v2[i]; for(int i=n/2;i<n;i++) ans += v2[i]; return ans; }

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

tickets.cpp:2:31: error: 'std::vector' has not been declared
    2 | long long find_maximum(int k, std::vector<std::vector<int>> x) {
      |                               ^~~
tickets.cpp:2:42: error: expected ',' or '...' before '<' token
    2 | long long find_maximum(int k, std::vector<std::vector<int>> x) {
      |                                          ^
tickets.cpp: In function 'long long int find_maximum(int, int)':
tickets.cpp:3:13: error: 'x' was not declared in this scope
    3 |     int n = x.size();
      |             ^
tickets.cpp:6:5: error: 'vector' was not declared in this scope
    6 |     vector<vector<int>> v(n, vector<int>(m));
      |     ^~~~~~
tickets.cpp:6:19: error: expected primary-expression before 'int'
    6 |     vector<vector<int>> v(n, vector<int>(m));
      |                   ^~~
tickets.cpp:7:22: error: 'v' was not declared in this scope
    7 |     allocate_tickets(v);
      |                      ^
tickets.cpp:7:5: error: 'allocate_tickets' was not declared in this scope
    7 |     allocate_tickets(v);
      |     ^~~~~~~~~~~~~~~~
tickets.cpp:9:12: error: expected primary-expression before 'int'
    9 |     vector<int> v2;
      |            ^~~
tickets.cpp:10:26: error: 'v2' was not declared in this scope
   10 |     for(int i=0;i<n;i++) v2.push_back(x[i][0]);
      |                          ^~
tickets.cpp:12:5: error: 'll' was not declared in this scope
   12 |     ll ans = 0;
      |     ^~
tickets.cpp:13:28: error: 'ans' was not declared in this scope
   13 |     for(int i=0;i<n/2;i++) ans -= v2[i];
      |                            ^~~
tickets.cpp:13:35: error: 'v2' was not declared in this scope
   13 |     for(int i=0;i<n/2;i++) ans -= v2[i];
      |                                   ^~
tickets.cpp:14:28: error: 'ans' was not declared in this scope
   14 |     for(int i=n/2;i<n;i++) ans += v2[i];
      |                            ^~~
tickets.cpp:14:35: error: 'v2' was not declared in this scope
   14 |     for(int i=n/2;i<n;i++) ans += v2[i];
      |                                   ^~
tickets.cpp:16:12: error: 'ans' was not declared in this scope
   16 |     return ans;
      |            ^~~
tickets.cpp:4:9: warning: unused variable 'm' [-Wunused-variable]
    4 |     int m = x[0].size();
      |         ^