Submission #572896

#TimeUsernameProblemLanguageResultExecution timeMemory
572896SlavicGVision Program (IOI19_vision)C++17
Compilation error
0 ms0 KiB
#include "vision.h" #include "bits/stdc++.h" using namespace std; #define ll long long #define forn(i,n) for(int i=0;i<n;i++) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(),v.rend() #define pb push_back #define sz(a) (int)a.size() /* int add_not(int N){} int add_and(vector<int> Ns){} int add_or(vector<int> Ns){} int add_xor(vector<int> Ns){} */ void construct_network(int H, int W, int K) { vector<int> indices; if(H <= 10 && W <= 10) { bool vis[H][W][H][W]; forn(a, H) forn(b, W) forn(c, H) forn(d, W) vis[a][b][c][d] = false; for(int i = 0; i < H; ++i) { for(int j = 0; j < W; ++j) { for(int x = 0; x < H; ++x) { for(int y = 0; y < W; ++y) { if(x == i && j == y) continue; if(vis[i][j][x][y]) continue; if(abs(x - i) + abs(y - j) != K) continue; vis[i][j][x][y] = vis[x][y][i][j] = true; vector<int> purice = {i * W + j, x * W + y}; sort(all(purice)); indices.pb(add_and(purice)); } } } } if(sz(indices) == 0) { vector<int> bruh; for(int i = 0; i < H * W; ++i) bruh.pb(i); add_and(bruh); return; } add_or(indices); return; } else { vector<int> Paiu; for(int i = 0; i < H; ++i) { for(int j = 0; j < W; ++j) { if(i + j != k) continue; if(i == 0 && j == 0) continue; Paiu.pb({0, i * W + j}); } } add_or(Paiu); return; } } /* void solve() { } int32_t main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int t = 1; //cin >> t; while(t--) { solve(); } } */

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:54:29: error: 'k' was not declared in this scope
   54 |                 if(i + j != k) continue;
      |                             ^
vision.cpp:56:39: error: no matching function for call to 'std::vector<int>::push_back(<brace-enclosed initializer list>)'
   56 |                 Paiu.pb({0, i * W + j});
      |                                       ^
In file included from /usr/include/c++/10/vector:67,
                 from vision.h:5,
                 from vision.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 = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = 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 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 = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = 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<int>::value_type&&' {aka 'int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~