Submission #733559

#TimeUsernameProblemLanguageResultExecution timeMemory
733559minhcoolMars (APIO22_mars)C++17
Compilation error
0 ms0 KiB
#include "mars.h" #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back #define mp make_pair typedef pair<int, int> ii; typedef pair<ii, int> iii; typedef pair<ii, ii> iiii; const int N = 35; const int oo = 1e18 + 7, mod = 1e9 + 7; vector<ii> route[N][N][N]; int cnt[N][N][N][N]; ii save[N][N][N][N][105];// cell (i, j) at phase k, the h-th bit will save the value of what node void prep(int id){// preparing the route for (i, j) // in order to get 36, we don't need the SA the path int n = id; for(int i = 0; i < (2 * n + 1); i++){ for(int j = 0; j < (2 * n + 1); j++){ route[id][i][j].clear(); for(int k = 0; k < (2 * n + 1); k++) cnt[id][i][j][k] = 0; } } for(int i = 0; i < (2 * n + 1); i++){ for(int j = 0; j < (2 * n + 1); j++){ for(int k = 0; k < n; k++){ route[id][i][j].pb({i - 2 * max(0LL, min(k, (i - 1) / 2)), j - 2 * max(0LL, min(k, (j - 1) / 2))}); } int itr = 0; for(auto it : route[id][i][j]){ //cout << i << " " << j << " " << it.fi << " " << it.se << " " << itr << "\n"; save[id][it.fi][it.se][itr][cnt[id][it.fi][it.se][itr]] = {i, j}; cnt[id][it.fi][it.se][itr]++; itr++; } } } for(int i = 0; i <= 2 * n; i++){ for(int j = 0; j <= 2 * n; j++){ for(int k = 0; k < n; k++){ for(int kk = 0; kk < cnt[id][i][j][k]; kk++){ //cout << i << " " << j << " " << k << " " << kk << " " << save[i][j][k][kk].fi << " " << save[i][j][k][kk].se << "\n"; } } } } } bool vis[N][N]; int val[N][N]; void ff(int i, int j, int n){ //cout << i << " " << j << "\n"; if(i < 0 || j < 0 || i >= (2 * n + 1) || j >= (2 * n + 1) || !val[i][j]) return; val[i][j] = 0; ff(i + 1, j, n); ff(i - 1, j, n); ff(i, j - 1, n); ff(i, j + 1, n); } string process(vector<vector<string>> a, int i, int j, int k, int n){ prep(n); //cout << "OK\n"; for(int ii = 0; ii <= 2 * n; ii++){ for(int jj = 0; jj <= 2 * n; jj++) vis[ii][jj] = 0; } for(int ii = 0; ii <= 2; ii++){ for(int jj = 0; jj <= 2; jj++){ for(int kk = 0; kk < cnt[n][i + ii][j + jj][k]; kk++){ int x = save[n][i + ii][j + jj][k][kk].fi, y = save[n][i + ii][j + jj][k][kk].se; val[x][y] = a[ii][jj][kk] - '0'; vis[x][y] = 1; //cout << i << " " << j << " " << k << " " << x << " " << y << " " << val[x][y] << "\n"; } } } if(k == n - 1){ //exit(0); int ans = 0; /* for(int i = 0; i < (2 * n) + 1; i++){ for(int j = 0; j < (2 * n) + 1; j++) cout << val[i][j] << " "; cout << "\n"; }*/ for(int i = 0; i < (2 * n + 1); i++){ for(int j = 0; j < (2 * n + 1); j++){ assert(vis[i][j]); // cout << "OK " << i << " " << j << " " << val[i][j] << "\n"; if(!val[i][j]) continue; ans++; ff(i, j, n); } } //cout << ans << "\n"; string temp; for(int kk = 0; kk < 100; kk++) temp += '0'; for(int kk = 0; kk < 20; kk++) if(ans & (1LL << kk)) temp[kk] = '1'; return temp; } else{ string temp; for(int kk = 0; kk < 100; kk++) temp += '0'; for(int kk = 0; kk < cnt[n][i][j][k + 1]; kk++){ int x = save[n][i][j][k + 1][kk].fi, y = save[n][i][j][k + 1][kk].se; assert(vis[x][y]); temp[kk] = char(48 + val[x][y]); } return temp; } }

Compilation message (stderr)

mars.cpp:16:21: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   16 | const int oo = 1e18 + 7, mod = 1e9 + 7;
      |                ~~~~~^~~
mars.cpp: In function 'void prep(int)':
mars.cpp:34:61: error: no matching function for call to 'max(long long int, const int&)'
   34 |     route[id][i][j].pb({i - 2 * max(0LL, min(k, (i - 1) / 2)), j - 2 * max(0LL, min(k, (j - 1) / 2))});
      |                                                             ^
In file included from /usr/include/c++/10/vector:60,
                 from mars.h:1,
                 from mars.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:
mars.cpp:34:61: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |     route[id][i][j].pb({i - 2 * max(0LL, min(k, (i - 1) / 2)), j - 2 * max(0LL, min(k, (j - 1) / 2))});
      |                                                             ^
In file included from /usr/include/c++/10/vector:60,
                 from mars.h:1,
                 from mars.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:
mars.cpp:34:61: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |     route[id][i][j].pb({i - 2 * max(0LL, min(k, (i - 1) / 2)), j - 2 * max(0LL, min(k, (j - 1) / 2))});
      |                                                             ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from mars.cpp:2:
/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:
mars.cpp:34:61: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |     route[id][i][j].pb({i - 2 * max(0LL, min(k, (i - 1) / 2)), j - 2 * max(0LL, min(k, (j - 1) / 2))});
      |                                                             ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from mars.cpp:2:
/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:
mars.cpp:34:61: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |     route[id][i][j].pb({i - 2 * max(0LL, min(k, (i - 1) / 2)), j - 2 * max(0LL, min(k, (j - 1) / 2))});
      |                                                             ^
mars.cpp:34:100: error: no matching function for call to 'max(long long int, const int&)'
   34 |     route[id][i][j].pb({i - 2 * max(0LL, min(k, (i - 1) / 2)), j - 2 * max(0LL, min(k, (j - 1) / 2))});
      |                                                                                                    ^
In file included from /usr/include/c++/10/vector:60,
                 from mars.h:1,
                 from mars.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:
mars.cpp:34:100: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |     route[id][i][j].pb({i - 2 * max(0LL, min(k, (i - 1) / 2)), j - 2 * max(0LL, min(k, (j - 1) / 2))});
      |                                                                                                    ^
In file included from /usr/include/c++/10/vector:60,
                 from mars.h:1,
                 from mars.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:
mars.cpp:34:100: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   34 |     route[id][i][j].pb({i - 2 * max(0LL, min(k, (i - 1) / 2)), j - 2 * max(0LL, min(k, (j - 1) / 2))});
      |                                                                                                    ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from mars.cpp:2:
/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:
mars.cpp:34:100: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |     route[id][i][j].pb({i - 2 * max(0LL, min(k, (i - 1) / 2)), j - 2 * max(0LL, min(k, (j - 1) / 2))});
      |                                                                                                    ^
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from mars.cpp:2:
/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:
mars.cpp:34:100: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   34 |     route[id][i][j].pb({i - 2 * max(0LL, min(k, (i - 1) / 2)), j - 2 * max(0LL, min(k, (j - 1) / 2))});
      |                                                                                                    ^
mars.cpp:34:102: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(<brace-enclosed initializer list>)'
   34 |     route[id][i][j].pb({i - 2 * max(0LL, min(k, (i - 1) / 2)), j - 2 * max(0LL, min(k, (j - 1) / 2))});
      |                                                                                                      ^
In file included from /usr/include/c++/10/vector:67,
                 from mars.h:1,
                 from mars.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<int, int>&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = std::pair<int, int>; _Alloc = std::allocator<std::pair<int, int> >; std::vector<_Tp, _Alloc>::value_type = std::pair<int, int>]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~