# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1011104 | 1ne | Dungeons Game (IOI21_dungeons) | C++17 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "dungeons.h"
#include <vector>
#include <bits/stdc++.h>
using namespace std;
const int k = 20;
vector<vector<int>>table;
vector<vector<int>>nx;
vector<vector<int>>sum;
vector<int>S,P,W,L;
long long N;
void init(long long n, std::vector<long long> s, std::vector<long long> p, std::vector<long long> w, std::vector<long long> l) {
table.resize(n,vector<long long>(k));
nx.resize(n,vector<long long>(k,-1));
sum.resize(n,vector<long long>(k,0));
N = n;
S = s;
P = p;
W = w;
L = l;
for (long long i = 0;i<n;++i){
table[i][0] = s[i];
nx[i][0] = w[i];
sum[i][0] = s[i];
}
for (long long i = 1;i<k;++i){
for (long long j = 0;j<n;++j){
if (nx[j][i - 1] == -1 || nx[j][i - 1] == n)continue;
//cout<<nx[j][i - 1]<<'\n';
nx[j][i] = nx[nx[j][i - 1]][i - 1];
table[j][i] = max(table[j][i - 1],table[nx[j][i - 1]][i - 1] - sum[j][i - 1]);
sum[j][i] = sum[j][i - 1] + sum[nx[j][i - 1]][i - 1];
}
}
return;
}
long long simulate(long long x, long long z) {
long long Z = z;
while(x != N){
// cout<<x<<"->";
long long c = 0;
while(nx[x][c] != -1 && table[x][c] <= Z){
++c;
}
if (c != 0){
Z+=sum[x][c - 1];
x = nx[x][c - 1];
}
if (x != N){
Z+=P[x];
x = L[x];
}
}
// cout<<'\n';
return Z;
}
컴파일 시 표준 에러 (stderr) 메시지
dungeons.cpp: In function 'void init(long long int, std::vector<long long int>, std::vector<long long int>, std::vector<long long int>, std::vector<long long int>)': dungeons.cpp:12:37: error: no matching function for call to 'std::vector<std::vector<int> >::resize(long long int&, std::vector<long long int>)' 12 | table.resize(n,vector<long long>(k)); | ^ In file included from /usr/include/c++/10/vector:67, from dungeons.h:1, from dungeons.cpp:1: /usr/include/c++/10/bits/stl_vector.h:937:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::vector<_Tp, _Alloc>::size_type = long unsigned int]' 937 | resize(size_type __new_size) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:937:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/bits/stl_vector.h:957:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = std::vector<int>]' 957 | resize(size_type __new_size, const value_type& __x) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:957:54: note: no known conversion for argument 2 from 'std::vector<long long int>' to 'const value_type&' {aka 'const std::vector<int>&'} 957 | resize(size_type __new_size, const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ dungeons.cpp:13:37: error: no matching function for call to 'std::vector<std::vector<int> >::resize(long long int&, std::vector<long long int>)' 13 | nx.resize(n,vector<long long>(k,-1)); | ^ In file included from /usr/include/c++/10/vector:67, from dungeons.h:1, from dungeons.cpp:1: /usr/include/c++/10/bits/stl_vector.h:937:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::vector<_Tp, _Alloc>::size_type = long unsigned int]' 937 | resize(size_type __new_size) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:937:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/bits/stl_vector.h:957:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = std::vector<int>]' 957 | resize(size_type __new_size, const value_type& __x) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:957:54: note: no known conversion for argument 2 from 'std::vector<long long int>' to 'const value_type&' {aka 'const std::vector<int>&'} 957 | resize(size_type __new_size, const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ dungeons.cpp:14:37: error: no matching function for call to 'std::vector<std::vector<int> >::resize(long long int&, std::vector<long long int>)' 14 | sum.resize(n,vector<long long>(k,0)); | ^ In file included from /usr/include/c++/10/vector:67, from dungeons.h:1, from dungeons.cpp:1: /usr/include/c++/10/bits/stl_vector.h:937:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::vector<_Tp, _Alloc>::size_type = long unsigned int]' 937 | resize(size_type __new_size) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:937:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/bits/stl_vector.h:957:7: note: candidate: 'void std::vector<_Tp, _Alloc>::resize(std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = std::vector<int>; _Alloc = std::allocator<std::vector<int> >; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = std::vector<int>]' 957 | resize(size_type __new_size, const value_type& __x) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:957:54: note: no known conversion for argument 2 from 'std::vector<long long int>' to 'const value_type&' {aka 'const std::vector<int>&'} 957 | resize(size_type __new_size, const value_type& __x) | ~~~~~~~~~~~~~~~~~~^~~ dungeons.cpp:16:6: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'std::vector<long long int>') 16 | S = s; | ^ In file included from /usr/include/c++/10/vector:72, from dungeons.h:1, from dungeons.cpp:1: /usr/include/c++/10/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' 198 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/vector.tcc:199:42: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'const std::vector<int>&' 199 | operator=(const vector<_Tp, _Alloc>& __x) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/10/vector:67, from dungeons.h:1, from dungeons.cpp:1: /usr/include/c++/10/bits/stl_vector.h:709:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]' 709 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ^~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:709:26: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<int>&&' 709 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_vector.h:730:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]' 730 | operator=(initializer_list<value_type> __l) | ^~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:730:46: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::initializer_list<int>' 730 | operator=(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ dungeons.cpp:17:6: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'std::vector<long long int>') 17 | P = p; | ^ In file included from /usr/include/c++/10/vector:72, from dungeons.h:1, from dungeons.cpp:1: /usr/include/c++/10/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' 198 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/vector.tcc:199:42: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'const std::vector<int>&' 199 | operator=(const vector<_Tp, _Alloc>& __x) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/10/vector:67, from dungeons.h:1, from dungeons.cpp:1: /usr/include/c++/10/bits/stl_vector.h:709:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]' 709 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ^~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:709:26: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<int>&&' 709 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_vector.h:730:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]' 730 | operator=(initializer_list<value_type> __l) | ^~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:730:46: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::initializer_list<int>' 730 | operator=(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ dungeons.cpp:18:6: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'std::vector<long long int>') 18 | W = w; | ^ In file included from /usr/include/c++/10/vector:72, from dungeons.h:1, from dungeons.cpp:1: /usr/include/c++/10/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' 198 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/vector.tcc:199:42: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'const std::vector<int>&' 199 | operator=(const vector<_Tp, _Alloc>& __x) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/10/vector:67, from dungeons.h:1, from dungeons.cpp:1: /usr/include/c++/10/bits/stl_vector.h:709:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]' 709 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ^~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:709:26: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<int>&&' 709 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_vector.h:730:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]' 730 | operator=(initializer_list<value_type> __l) | ^~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:730:46: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::initializer_list<int>' 730 | operator=(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ dungeons.cpp:19:6: error: no match for 'operator=' (operand types are 'std::vector<int>' and 'std::vector<long long int>') 19 | L = l; | ^ In file included from /usr/include/c++/10/vector:72, from dungeons.h:1, from dungeons.cpp:1: /usr/include/c++/10/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' 198 | vector<_Tp, _Alloc>:: | ^~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/vector.tcc:199:42: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'const std::vector<int>&' 199 | operator=(const vector<_Tp, _Alloc>& __x) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ In file included from /usr/include/c++/10/vector:67, from dungeons.h:1, from dungeons.cpp:1: /usr/include/c++/10/bits/stl_vector.h:709:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]' 709 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ^~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:709:26: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::vector<int>&&' 709 | operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move()) | ~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_vector.h:730:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]' 730 | operator=(initializer_list<value_type> __l) | ^~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:730:46: note: no known conversion for argument 1 from 'std::vector<long long int>' to 'std::initializer_list<int>' 730 | operator=(initializer_list<value_type> __l) | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~