# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
826580 | arnold518 | Dungeons Game (IOI21_dungeons) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "dungeons.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int MAXN = 4e5;
const ll INF = 1e18;
int N;
int S[MAXN+10], P[MAXN+10], W[MAXN+10], L[MAXN+10];
vector<vector<int>> A, B, C;
ll D[MAXN+10];
int f(int i, int j)
{
return i*(i+1)/2+j;
}
void init(int _N, vector<int> _S, vector<int> _P, vector<int> _W, vector<int> _L)
{
N=_N;
for(int i=1; i<=N; i++)
{
S[i]=_S[i-1]; P[i]=_P[i-1];
W[i]=_W[i-1]+1; L[i]=_L[i-1]+1;
}
A=vector<int>(300, vector<int>(N+2));
B=vector<int>(300, vector<int>(N+2));
C=vector<int>(300, vector<int>(N+2));
for(int i=0; i<=23; i++)
{
int p=f(i, 0);
for(int j=1; j<=N; j++)
{
if(S[j]<(1<<i)) A[p][j]=S[j], B[p][j]=(1<<(i+1)), C[p][j]=W[j];
else if(S[j]<(1<<(i+1))) A[p][j]=P[j], B[p][j]=min((1<<(i+1)), S[j]), C[p][j]=L[j];
else A[p][j]=P[j], B[p][j]=(1<<(i+1)), C[p][j]=L[j];
}
A[p][N+1]=0, B[p][N+1]=0; C[p][N+1]=N+1;
for(int j=1; j<=i; j++)
{
p=f(i, j);
for(int k=1; k<=N+1; k++)
{
C[p][k]=C[p-1][C[p-1][k]];
A[p][k]=A[p-1][k]+A[p-1][C[p-1][k]];
B[p][k]=min(B[p-1][k], B[p-1][C[p-1][k]]-A[p-1][k]);
}
}
}
for(int i=N; i>=0; i--) D[i]=D[W[i]]+S[i];
}
ll simulate(int now, int _x)
{
now++;
ll x=_x;
for(int i=0; i<=23; i++)
{
if(x>=(1<<(i+1))) continue;
for(int j=i; j>=0; j--)
{
int p=f(i, j);
if(x<B[p][now])
{
x+=A[p][now];
now=C[p][now];
}
}
if(now>N) break;
if(x<(1<<(i+1)))
{
if(x>=S[now]) x+=S[now], now=W[now];
else x+=P[now], now=L[now];
}
}
return x+D[now];
}
Compilation message (stderr)
dungeons.cpp: In function 'void init(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)': dungeons.cpp:32:37: error: no matching function for call to 'std::vector<int>::vector(int, std::vector<int>)' 32 | A=vector<int>(300, vector<int>(N+2)); | ^ 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:653:2: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _Tp = int; _Alloc = std::allocator<int>]' 653 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:653:2: note: template argument deduction/substitution failed: dungeons.cpp:32:37: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<int>') 32 | A=vector<int>(300, vector<int>(N+2)); | ^ 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:625:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 625 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:625:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>' 625 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_vector.h:607:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 607 | vector(vector&& __rv, const allocator_type& __m) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:607:23: note: no known conversion for argument 1 from 'int' to 'std::vector<int>&&' 607 | vector(vector&& __rv, const allocator_type& __m) | ~~~~~~~~~^~~~ /usr/include/c++/10/bits/stl_vector.h:589:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::false_type = std::integral_constant<bool, false>]' 589 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:589:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/10/bits/stl_vector.h:585:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::true_type = std::integral_constant<bool, true>]' 585 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:585:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/10/bits/stl_vector.h:575:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 575 | vector(const vector& __x, const allocator_type& __a) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:575:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<int>&' 575 | vector(const vector& __x, const allocator_type& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_vector.h:572:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]' 572 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:572:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/bits/stl_vector.h:553:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' 553 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:553:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/bits/stl_vector.h:522:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 522 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:522:47: note: no known conversion for argument 2 from 'std::vector<int>' to 'const value_type&' {aka 'const int&'} 522 | vector(size_type __n, const value_type& __value, | ~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/10/bits/stl_vector.h:510:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 510 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:510:51: note: no known conversion for argument 2 from 'std::vector<int>' to 'const allocator_type&' {aka 'const std::allocator<int>&'} 510 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:497:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 497 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:497:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/bits/stl_vector.h:487:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = int; _Alloc = std::allocator<int>]' 487 | vector() = default; | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:487:7: note: candidate expects 0 arguments, 2 provided dungeons.cpp:33:37: error: no matching function for call to 'std::vector<int>::vector(int, std::vector<int>)' 33 | B=vector<int>(300, vector<int>(N+2)); | ^ 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:653:2: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _Tp = int; _Alloc = std::allocator<int>]' 653 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:653:2: note: template argument deduction/substitution failed: dungeons.cpp:33:37: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<int>') 33 | B=vector<int>(300, vector<int>(N+2)); | ^ 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:625:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 625 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:625:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>' 625 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_vector.h:607:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 607 | vector(vector&& __rv, const allocator_type& __m) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:607:23: note: no known conversion for argument 1 from 'int' to 'std::vector<int>&&' 607 | vector(vector&& __rv, const allocator_type& __m) | ~~~~~~~~~^~~~ /usr/include/c++/10/bits/stl_vector.h:589:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::false_type = std::integral_constant<bool, false>]' 589 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:589:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/10/bits/stl_vector.h:585:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::true_type = std::integral_constant<bool, true>]' 585 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:585:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/10/bits/stl_vector.h:575:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 575 | vector(const vector& __x, const allocator_type& __a) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:575:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<int>&' 575 | vector(const vector& __x, const allocator_type& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_vector.h:572:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]' 572 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:572:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/bits/stl_vector.h:553:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' 553 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:553:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/bits/stl_vector.h:522:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 522 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:522:47: note: no known conversion for argument 2 from 'std::vector<int>' to 'const value_type&' {aka 'const int&'} 522 | vector(size_type __n, const value_type& __value, | ~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/10/bits/stl_vector.h:510:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 510 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:510:51: note: no known conversion for argument 2 from 'std::vector<int>' to 'const allocator_type&' {aka 'const std::allocator<int>&'} 510 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:497:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 497 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:497:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/bits/stl_vector.h:487:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = int; _Alloc = std::allocator<int>]' 487 | vector() = default; | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:487:7: note: candidate expects 0 arguments, 2 provided dungeons.cpp:34:37: error: no matching function for call to 'std::vector<int>::vector(int, std::vector<int>)' 34 | C=vector<int>(300, vector<int>(N+2)); | ^ 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:653:2: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _Tp = int; _Alloc = std::allocator<int>]' 653 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:653:2: note: template argument deduction/substitution failed: dungeons.cpp:34:37: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<int>') 34 | C=vector<int>(300, vector<int>(N+2)); | ^ 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:625:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 625 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:625:43: note: no known conversion for argument 1 from 'int' to 'std::initializer_list<int>' 625 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_vector.h:607:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 607 | vector(vector&& __rv, const allocator_type& __m) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:607:23: note: no known conversion for argument 1 from 'int' to 'std::vector<int>&&' 607 | vector(vector&& __rv, const allocator_type& __m) | ~~~~~~~~~^~~~ /usr/include/c++/10/bits/stl_vector.h:589:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::false_type = std::integral_constant<bool, false>]' 589 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:589:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/10/bits/stl_vector.h:585:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::true_type = std::integral_constant<bool, true>]' 585 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:585:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/10/bits/stl_vector.h:575:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 575 | vector(const vector& __x, const allocator_type& __a) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:575:28: note: no known conversion for argument 1 from 'int' to 'const std::vector<int>&' 575 | vector(const vector& __x, const allocator_type& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_vector.h:572:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]' 572 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:572:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/bits/stl_vector.h:553:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' 553 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:553:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/10/bits/stl_vector.h:522:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 522 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/10/bits/stl_vector.h:522:47: note: no known conversion for argument 2 from 'std::vector<int>' to 'const value_type&' {aka 'const int&'} 522 | vector(size_type __n, const value_type& __value, | ~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/10/bits/stl_vector.h:510:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_