Submission #152211

# Submission time Handle Problem Language Result Execution time Memory
152211 2019-09-06T19:25:24 Z nvmdava Vision Program (IOI19_vision) C++17
Compilation error
0 ms 0 KB
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;

int q;
vector<int> s, d;
int h, w, k;

vector<int> find(int c1, int c2, int s){
	vector<int> res;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(i * c1 + j * c2 == s){
				res.push_back()
			}
		}
	}
}

int get(vector<int> pref, int k){
	vector<int> ask;
	for(int i = k; i < pref.size(); i++)
		ask.push_back(add_and({pref[i - k], pref[i]}));
	
	return add_or(ask);
}

void construct_network(int H, int W, int K){
    q = H * W - 1;

    h = H;
    w = W;
    k = K;

    for(int i = 0; i < H + W - 1; i++){
    	vector<int> ask = find(1, 1, i);
    	if(s.empty())
    		s.push_back(add_or(ask));
    	else 
    		s.push_back(add_xor(ask, add_or(ask)));
    }
    
    for(int i = 1 - W; i <= H - 1; i++){
    	vector<int> ask; = find(1, -1, i);
    	if(d.empty())
    		d.push_back(add_or(ask));
    	else 
    		d.push_back(add_xor(ask, add_or(ask)));
    }

    int sk = get(s, k - 1);
    int sk1 = get(s, k);
    int dk = get(d, k - 1);
    int dk1 = get(d, k);

    add_and({add_or({sk, dk}), add_not({add_or(sk1, dk1)})});
}

Compilation message

vision.cpp: In function 'std::vector<int> find(int, int, int)':
vision.cpp:14:19: error: no matching function for call to 'std::vector<int>::push_back()'
     res.push_back()
                   ^
In file included from /usr/include/c++/7/vector:64:0,
                 from vision.h:5,
                 from vision.cpp:1:
/usr/include/c++/7/bits/stl_vector.h:939: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]
       push_back(const value_type& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:939:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/7/bits/stl_vector.h:953: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]
       push_back(value_type&& __x)
       ^~~~~~~~~
/usr/include/c++/7/bits/stl_vector.h:953:7: note:   candidate expects 1 argument, 0 provided
vision.cpp:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
vision.cpp: In function 'int get(std::vector<int>, int)':
vision.cpp:22:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = k; i < pref.size(); i++)
                 ~~^~~~~~~~~~~~~
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:40:43: error: too many arguments to function 'int add_xor(std::vector<int>)'
       s.push_back(add_xor(ask, add_or(ask)));
                                           ^
In file included from vision.cpp:1:0:
vision.h:14:5: note: declared here
 int add_xor(std::vector<int> Ns);
     ^~~~~~~
vision.cpp:44:23: error: expected primary-expression before '=' token
      vector<int> ask; = find(1, -1, i);
                       ^
vision.cpp:48:43: error: too many arguments to function 'int add_xor(std::vector<int>)'
       d.push_back(add_xor(ask, add_or(ask)));
                                           ^
In file included from vision.cpp:1:0:
vision.h:14:5: note: declared here
 int add_xor(std::vector<int> Ns);
     ^~~~~~~
vision.cpp:56:56: error: could not convert 'sk1' from 'int' to 'std::vector<int>'
     add_and({add_or({sk, dk}), add_not({add_or(sk1, dk1)})});
                                                        ^
vision.cpp:56:58: error: cannot convert '<brace-enclosed initializer list>' to 'int' for argument '1' to 'int add_not(int)'
     add_and({add_or({sk, dk}), add_not({add_or(sk1, dk1)})});
                                                          ^
vision.cpp:56:60: error: could not convert '{add_or(std::vector<int>(std::initializer_list<int>{((const int*)(& const int [2]{sk, dk})), 2}, std::allocator<int>())), <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
     add_and({add_or({sk, dk}), add_not({add_or(sk1, dk1)})});
                                                            ^