Submission #1195234

#TimeUsernameProblemLanguageResultExecution timeMemory
1195234nikulidVision Program (IOI19_vision)C++20
Compilation error
0 ms0 KiB
#include "vision.h" using namespace std; int dist(a, b, w){ int ra, ca, rb, cb; ra = a%w; rb = b%w; ca = a/w; cb = b/w; return abs(ra-rb)+abs(ca-cb); } void construct_network(int H, int W, int K) { vector<int> ns; vector<int> bigns(0); lastindex = H*W-2; // lemma 2: brute force is not sigma. int n=H*W; for(int i=0; i<n; i++){ ns = {i}; lastindex++; add_or(ns); // this is @ lastindex now :p for(int j=0; j<n; j++){ if(j>i && dist(i,j)==K){ ns.push_back(j); } } add_or(ns); // this is @ lastindex+1 :p ns = {lastindex, lastindex+1}; add_and(ns); // this is @ lastindex+2 :P bigns.push_back(lastindex+2); lastindex+=2; } add_or(bigns); }

Compilation message (stderr)

vision.cpp:5:18: error: 'a' was not declared in this scope
    5 |         int dist(a, b, w){
      |                  ^
vision.cpp:5:21: error: 'b' was not declared in this scope
    5 |         int dist(a, b, w){
      |                     ^
vision.cpp:5:24: error: 'w' was not declared in this scope
    5 |         int dist(a, b, w){
      |                        ^
vision.cpp:5:25: error: expression list treated as compound expression in initializer [-fpermissive]
    5 |         int dist(a, b, w){
      |                         ^
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:17:17: error: 'lastindex' was not declared in this scope
   17 |                 lastindex = H*W-2;
      |                 ^~~~~~~~~
vision.cpp:27:47: error: 'dist' cannot be used as a function
   27 |                                 if(j>i && dist(i,j)==K){
      |                                           ~~~~^~~~~
vision.cpp:32:53: error: no match for 'operator=' (operand types are 'std::vector<int>' and '<brace-enclosed initializer list>')
   32 |                         ns = {lastindex, lastindex+1};
      |                                                     ^
In file included from /usr/include/c++/11/vector:72,
                 from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/11/bits/vector.tcc:198:5: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]'
  198 |     vector<_Tp, _Alloc>::
      |     ^~~~~~~~~~~~~~~~~~~
/usr/include/c++/11/bits/vector.tcc:199:42: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const std::vector<int>&'
  199 |     operator=(const vector<_Tp, _Alloc>& __x)
      |               ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
In file included from /usr/include/c++/11/vector:67,
                 from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/11/bits/stl_vector.h:709:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:709:26: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>&&'
  709 |       operator=(vector&& __x) noexcept(_Alloc_traits::_S_nothrow_move())
      |                 ~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_vector.h:730:7: note: candidate: 'std::vector<_Tp, _Alloc>& std::vector<_Tp, _Alloc>::operator=(std::initializer_list<_Tp>) [with _Tp = int; _Alloc = std::allocator<int>]'
  730 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_vector.h:730:46: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::initializer_list<int>'
  730 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~