Submission #1056339

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10563392024-08-13 08:55:38Huseyn123Dungeons Game (IOI21_dungeons)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "dungeons.h"
#define INF LLONG_MAX
using namespace std;
typedef long long ll;
const int lgb=8;
const int lg=6;
ll st0[lg][25][400001];
int st1[lg][25][400001];
int st2[lg][25][400001];
vector<int> S,P,W,L;
int N;
void init(int n, vector<int> s, vector<int> p, vector<int> w, vector<int> l) {
s.push_back(0);
N=n;
S=s;
P=p;
W=w;
L=l;
for(int i=0;i<lg;i++){
for(int z=0;z<n;z++){
if(s[z]<(1<<i)){
st0[i][0][z]=s[z];
if(w[z]!=n && s[w[z]]<(1<<i)){
st1[i][0][z]=-INF;
}
else{
st1[i][0][z]=s[z]-s[w[z]];
}
st2[i][0][z]=w[z];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

dungeons.cpp: In function 'void init(int, std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
dungeons.cpp:25:19: warning: overflow in conversion from 'long long int' to 'int' changes value from '-9223372036854775807' to '1' [-Woverflow]
   25 |      st1[i][0][z]=-INF;
      |                   ^
dungeons.cpp:35:19: warning: overflow in conversion from 'long long int' to 'int' changes value from '-9223372036854775807' to '1' [-Woverflow]
   35 |      st1[i][0][z]=-INF;
      |                   ^
dungeons.cpp:54:66: error: no matching function for call to 'max(int&, ll)'
   54 |       st1[i][j][z]=max(st1[i][j][z],st1[i][j-1][ind]+st0[i][j][z]);
      |                                                                  ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from dungeons.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
dungeons.cpp:54:66: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   54 |       st1[i][j][z]=max(st1[i][j][z],st1[i][j-1][ind]+st0[i][j][z]);
      |                                                                  ^
In file included from /usr/include/c++/10/bits/specfun.h:45,
                 from /usr/include/c++/10/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:41,
                 from dungeons.cpp:1:
/usr/include/c++/10/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
dungeons.cpp:54:66: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   54 |       st1[i][j][z]=max(st1[i][j][z],st1[i][j-1][ind]+st0[i][j][z]);
      |                                                                  ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from dungeons.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3480:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3480 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3480:5: note:   template argument deduction/substitution failed:
dungeons.cpp:54:66: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   54 |       st1[i][j][z]=max(st1[i][j][z],st1[i][j-1][ind]+st0[i][j][z]);
      |                                                                  ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from dungeons.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/10/bits/stl_algo.h:3486:5: note:   template argument deduction/substitution failed:
dungeons.cpp:54:66: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   54 |       st1[i][j][z]=max(st1[i][j][z],st1[i][j-1][ind]+st0[i][j][z]);
      |                                                                  ^