제출 #774073

#제출 시각아이디문제언어결과실행 시간메모리
774073jasmin죄수들의 도전 (IOI22_prison)C++17
컴파일 에러
0 ms0 KiB
#include "prison.h" #include<bits/stdc++.h> using namespace std; std::vector<std::vector<int>> devise_strategy(int n) { vector<int> ans(n+1, -1); ans[0][0]=0; for(int i=1; i<=n; i++){ ans[i][0]=1; } for(int i=1; i<=n; i++){ for(int j=1; j<=n; j++){ if(j<i){ ans[i][j]=-2; } else{ ans[i][j]=-1; } } } return ans; }

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

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:9:11: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
    9 |     ans[0][0]=0;
      |           ^
prison.cpp:11:15: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   11 |         ans[i][0]=1;
      |               ^
prison.cpp:18:23: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   18 |                 ans[i][j]=-2;
      |                       ^
prison.cpp:21:23: error: invalid types '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type {aka int}[int]' for array subscript
   21 |                 ans[i][j]=-1;
      |                       ^
prison.cpp:27:12: error: could not convert 'ans' from 'vector<int>' to 'vector<std::vector<int>>'
   27 |     return ans;
      |            ^~~
      |            |
      |            vector<int>