Submission #370339

#TimeUsernameProblemLanguageResultExecution timeMemory
370339MilosMilutinovicVision Program (IOI19_vision)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "vision.h" using namespace std; #define pb push_back int h,w,k; int Get(int i,int j)}{return i*w+j;} void SolveBF(){ vector<pair<int,int>> ask; int cnt=h*w; for(int i=0;i<h;i++){ for(int j=0;j<w;j++){ for(int x=i;x<h;x++){ for(int y=j;y<w;j++){ int dist=x-i+y-j; if(dist!=k)continue; add_and(Get(i,j),Get(x,y)); ask.pb(cnt++); } } } } add_or(ask); } void construct_network(int H,int W,int K){ h=H,w=W,k=K; if(max(H,W)<=30){ SolveBF(); return; } }

Compilation message (stderr)

vision.cpp:6:21: error: expected initializer before '}' token
    6 | int Get(int i,int j)}{return i*w+j;}
      |                     ^
vision.cpp:6:21: error: expected declaration before '}' token
vision.cpp:6:22: error: expected unqualified-id before '{' token
    6 | int Get(int i,int j)}{return i*w+j;}
      |                      ^
vision.cpp: In function 'void SolveBF()':
vision.cpp:16:14: error: 'Get' was not declared in this scope
   16 |      add_and(Get(i,j),Get(x,y));
      |              ^~~
vision.cpp:17:18: error: no matching function for call to 'std::vector<std::pair<int, int> >::push_back(int)'
   17 |      ask.pb(cnt++);
      |                  ^
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from vision.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:1184: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>]'
 1184 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1184:35: note:   no known conversion for argument 1 from 'int' to 'const value_type&' {aka 'const std::pair<int, int>&'}
 1184 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_vector.h:1200: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>]'
 1200 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1200:30: note:   no known conversion for argument 1 from 'int' to 'std::vector<std::pair<int, int> >::value_type&&' {aka 'std::pair<int, int>&&'}
 1200 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
vision.cpp:22:9: error: could not convert 'ask' from 'vector<std::pair<int, int>>' to 'vector<int>'
   22 |  add_or(ask);
      |         ^~~
      |         |
      |         vector<std::pair<int, int>>