Submission #205389

# Submission time Handle Problem Language Result Execution time Memory
205389 2020-02-28T18:39:54 Z my99n Vision Program (IOI19_vision) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "vision.h"
int h, w;
int order (int x, int y) { return x*w+y; }
// void print (vector<int> v) { for (auto x : v) cerr << x << ' '; cerr << endl;}

void construct_network(int H, int W, int K) {
	h=H; w=W;
	vector<int> firstor, secondor, _and;
	for (int i = 0; i < H+W-1; i++) {
		vector<int> v1, v2;
		for (int j = 0; j < min(i+1, W); j++) {
			if (!(i-j >= H or j >= W)) v1.push_back(order(i-j, j));
			if (!(i-j >= H or W-1-j >= W)) v2.push_back(order(i-j, W-1-j));
		}
		// cerr << "print1 "; print(v1);
		// cerr << "print2 "; print(v2);
		firstor.push_back(add_or(v1));
		secondor.push_back(add_or(v2));
	}
	for (int i = 0; i < firstor.size(); i++) {
		if (i+K >= firstor.size()) break;
		_and.push_back(add_and({firstor[i], firstor[i+K]}));
		_and.push_back(add_and({secondor[i], secondor[i+K]}));
	}
	int ans = add_or(_and);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:9:2: error: 'vector' was not declared in this scope
  vector<int> firstor, secondor, _and;
  ^~~~~~
vision.cpp:9:2: note: suggested alternative:
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from vision.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:216:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
vision.cpp:9:9: error: expected primary-expression before 'int'
  vector<int> firstor, secondor, _and;
         ^~~
vision.cpp:11:10: error: expected primary-expression before 'int'
   vector<int> v1, v2;
          ^~~
vision.cpp:12:23: error: 'min' was not declared in this scope
   for (int j = 0; j < min(i+1, W); j++) {
                       ^~~
vision.cpp:12:23: note: suggested alternative:
In file included from /usr/include/c++/7/algorithm:62:0,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:65,
                 from vision.cpp:1:
/usr/include/c++/7/bits/stl_algo.h:3456:5: note:   'std::min'
     min(initializer_list<_Tp> __l, _Compare __comp)
     ^~~
vision.cpp:13:31: error: 'v1' was not declared in this scope
    if (!(i-j >= H or j >= W)) v1.push_back(order(i-j, j));
                               ^~
vision.cpp:13:31: note: suggested alternative: 'y1'
    if (!(i-j >= H or j >= W)) v1.push_back(order(i-j, j));
                               ^~
                               y1
vision.cpp:14:35: error: 'v2' was not declared in this scope
    if (!(i-j >= H or W-1-j >= W)) v2.push_back(order(i-j, W-1-j));
                                   ^~
vision.cpp:18:3: error: 'firstor' was not declared in this scope
   firstor.push_back(add_or(v1));
   ^~~~~~~
vision.cpp:18:3: note: suggested alternative: 'strstr'
   firstor.push_back(add_or(v1));
   ^~~~~~~
   strstr
vision.cpp:18:28: error: 'v1' was not declared in this scope
   firstor.push_back(add_or(v1));
                            ^~
vision.cpp:18:28: note: suggested alternative: 'y1'
   firstor.push_back(add_or(v1));
                            ^~
                            y1
vision.cpp:19:3: error: 'secondor' was not declared in this scope
   secondor.push_back(add_or(v2));
   ^~~~~~~~
vision.cpp:19:3: note: suggested alternative: 'srandom'
   secondor.push_back(add_or(v2));
   ^~~~~~~~
   srandom
vision.cpp:19:29: error: 'v2' was not declared in this scope
   secondor.push_back(add_or(v2));
                             ^~
vision.cpp:21:22: error: 'firstor' was not declared in this scope
  for (int i = 0; i < firstor.size(); i++) {
                      ^~~~~~~
vision.cpp:21:22: note: suggested alternative: 'strstr'
  for (int i = 0; i < firstor.size(); i++) {
                      ^~~~~~~
                      strstr
vision.cpp:23:3: error: '_and' was not declared in this scope
   _and.push_back(add_and({firstor[i], firstor[i+K]}));
   ^~~~
vision.cpp:23:3: note: suggested alternative: 'rand'
   _and.push_back(add_and({firstor[i], firstor[i+K]}));
   ^~~~
   rand
vision.cpp:23:52: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   _and.push_back(add_and({firstor[i], firstor[i+K]}));
                                                    ^
vision.cpp:24:27: error: 'secondor' was not declared in this scope
   _and.push_back(add_and({secondor[i], secondor[i+K]}));
                           ^~~~~~~~
vision.cpp:24:27: note: suggested alternative: 'srandom'
   _and.push_back(add_and({secondor[i], secondor[i+K]}));
                           ^~~~~~~~
                           srandom
vision.cpp:24:54: error: could not convert '{<expression error>, <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   _and.push_back(add_and({secondor[i], secondor[i+K]}));
                                                      ^
vision.cpp:26:19: error: '_and' was not declared in this scope
  int ans = add_or(_and);
                   ^~~~
vision.cpp:26:19: note: suggested alternative: 'rand'
  int ans = add_or(_and);
                   ^~~~
                   rand
vision.cpp:26:6: warning: unused variable 'ans' [-Wunused-variable]
  int ans = add_or(_and);
      ^~~