# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
316663 | jainbot27 | Vision Program (IOI19_vision) | C++17 | Compilation error | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
#define ar array
#define all(x) x.begin(), x.end()
#define siz(x) (int)x.size()
#define FOR(x, y, z) for(int x = (y); x < (z); x++)
#define ROF(x, z, y) for(int x = (y-1); x >= (z); x--)
#define F0R(x, z) FOR(x, 0, z)
#define R0F(x, z) ROF(x, 0, z)
#define trav(x, y) for(auto&x:y)
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
template<class T> inline bool ckmin(T&a, T b) {return b < a ? a = b, 1 : 0;}
template<class T> inline bool ckmax(T&a, T b) {return b > a ? a = b, 1 : 0;}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const char nl = '\n';
const int mxN = 2e5 + 10;
const int MOD = 1e9 + 7;
const long long infLL = 1e18;
void construct_network(int n, int m, int k){
vector<vi> di0(n+m-1), di1(n+m-1);
vi tot0(n+m-1), tot1(n+m-1);
F0R(i, n){
F0R(j, m){
di0[i+j].pb(i*m+j);
di1[i+j].pb(i*m+(m-1-j));
}
}
F0R(i, n+m-1){
tot0[i] = add_or(di0[i]);
tot1[i] = add_or(di1[i]);
}
vi p0(n + m - 1), p1(n + m - 1);
p0[0] = tot0[0], p1[0] = tot1[0];
FOR(i, 1, n+m-1){
p0[i]=add_or(vi{p0[i-1],di0[i]});
p1[i]=add_or(vi{p1[i-1],di1[i]});
}
int nk0 = -1, nk1 = -1;
F0R(i, 2){
int K = (i == 0 ? k : k + 1);
int& nk = (i == 0 ? nk0 : nk1);
vi al;
FOR(s, 0, n+m-1-K){
al.pb(add_and({p0[s], tot0[s+K]}));
}
FOR(s, 0, n+m-1-K){
al.pb(add_and({p1[s], tot0[s+K]}));
}
if(siz(al))
nk = add_or(al);
}
if(nk1 == -1){
add_or({nk, nk});
}
else{
add_xor({nk, nk1});
}
}
//int32_t main(){
// ios_base::sync_with_stdio(0); cin.tie(0);
// return 0;
//}
Compilation message (stderr)
vision.cpp: In function 'void construct_network(int, int, int)': vision.cpp:42:19: error: 'add_or' was not declared in this scope 42 | tot0[i] = add_or(di0[i]); | ^~~~~~ vision.cpp:48:39: error: no matching function for call to 'std::vector<int>::vector(<brace-enclosed initializer list>)' 48 | p0[i]=add_or(vi{p0[i-1],di0[i]}); | ^ In file included from /usr/include/c++/9/vector:67, from /usr/include/c++/9/functional:62, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from vision.cpp:1: /usr/include/c++/9/bits/stl_vector.h:650:2: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&)' 650 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:650:2: note: template argument deduction/substitution failed: vision.cpp:48:39: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<int>') 48 | p0[i]=add_or(vi{p0[i-1],di0[i]}); | ^ In file included from /usr/include/c++/9/vector:67, from /usr/include/c++/9/functional:62, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from vision.cpp:1: /usr/include/c++/9/bits/stl_vector.h:622:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 622 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:622:43: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::initializer_list<int>' 622 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/9/bits/stl_vector.h:604:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 604 | vector(vector&& __rv, const allocator_type& __m) | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:604:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::vector<int>&&' 604 | vector(vector&& __rv, const allocator_type& __m) | ~~~~~~~~~^~~~ /usr/include/c++/9/bits/stl_vector.h:586:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::false_type = std::integral_constant<bool, false>]' 586 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:586:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/9/bits/stl_vector.h:582:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::true_type = std::integral_constant<bool, true>]' 582 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:582:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/9/bits/stl_vector.h:572:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 572 | vector(const vector& __x, const allocator_type& __a) | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:572:28: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'const std::vector<int>&' 572 | vector(const vector& __x, const allocator_type& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/9/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]' 569 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:569:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/9/bits/stl_vector.h:550:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' 550 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:550:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/9/bits/stl_vector.h:519:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 519 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:519:47: note: no known conversion for argument 2 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'const value_type&' {aka 'const int&'} 519 | vector(size_type __n, const value_type& __value, | ~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/9/bits/stl_vector.h:507:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 507 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:507:51: note: no known conversion for argument 2 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'const allocator_type&' {aka 'const std::allocator<int>&'} 507 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/9/bits/stl_vector.h:494:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 494 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:494:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/9/bits/stl_vector.h:484:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = int; _Alloc = std::allocator<int>]' 484 | vector() = default; | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:484:7: note: candidate expects 0 arguments, 2 provided vision.cpp:48:15: error: 'add_or' was not declared in this scope 48 | p0[i]=add_or(vi{p0[i-1],di0[i]}); | ^~~~~~ vision.cpp:49:39: error: no matching function for call to 'std::vector<int>::vector(<brace-enclosed initializer list>)' 49 | p1[i]=add_or(vi{p1[i-1],di1[i]}); | ^ In file included from /usr/include/c++/9/vector:67, from /usr/include/c++/9/functional:62, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from vision.cpp:1: /usr/include/c++/9/bits/stl_vector.h:650:2: note: candidate: 'template<class _InputIterator, class> std::vector<_Tp, _Alloc>::vector(_InputIterator, _InputIterator, const allocator_type&)' 650 | vector(_InputIterator __first, _InputIterator __last, | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:650:2: note: template argument deduction/substitution failed: vision.cpp:49:39: note: deduced conflicting types for parameter '_InputIterator' ('int' and 'std::vector<int>') 49 | p1[i]=add_or(vi{p1[i-1],di1[i]}); | ^ In file included from /usr/include/c++/9/vector:67, from /usr/include/c++/9/functional:62, from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/9/algorithm:71, from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65, from vision.cpp:1: /usr/include/c++/9/bits/stl_vector.h:622:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::initializer_list<_Tp>, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 622 | vector(initializer_list<value_type> __l, | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:622:43: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::initializer_list<int>' 622 | vector(initializer_list<value_type> __l, | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~ /usr/include/c++/9/bits/stl_vector.h:604:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 604 | vector(vector&& __rv, const allocator_type& __m) | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:604:23: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'std::vector<int>&&' 604 | vector(vector&& __rv, const allocator_type& __m) | ~~~~~~~~~^~~~ /usr/include/c++/9/bits/stl_vector.h:586:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::false_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::false_type = std::integral_constant<bool, false>]' 586 | vector(vector&& __rv, const allocator_type& __m, false_type) | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:586:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/9/bits/stl_vector.h:582:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&, const allocator_type&, std::true_type) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>; std::true_type = std::integral_constant<bool, true>]' 582 | vector(vector&& __rv, const allocator_type& __m, true_type) noexcept | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:582:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/9/bits/stl_vector.h:572:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 572 | vector(const vector& __x, const allocator_type& __a) | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:572:28: note: no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} to 'const std::vector<int>&' 572 | vector(const vector& __x, const allocator_type& __a) | ~~~~~~~~~~~~~~^~~ /usr/include/c++/9/bits/stl_vector.h:569:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>&&) [with _Tp = int; _Alloc = std::allocator<int>]' 569 | vector(vector&&) noexcept = default; | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:569:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/9/bits/stl_vector.h:550:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = int; _Alloc = std::allocator<int>]' 550 | vector(const vector& __x) | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:550:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/9/bits/stl_vector.h:519:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const value_type&, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::value_type = int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 519 | vector(size_type __n, const value_type& __value, | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:519:47: note: no known conversion for argument 2 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'const value_type&' {aka 'const int&'} 519 | vector(size_type __n, const value_type& __value, | ~~~~~~~~~~~~~~~~~~^~~~~~~ /usr/include/c++/9/bits/stl_vector.h:507:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(std::vector<_Tp, _Alloc>::size_type, const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::size_type = long unsigned int; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 507 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:507:51: note: no known conversion for argument 2 from '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'std::vector<int>'} to 'const allocator_type&' {aka 'const std::allocator<int>&'} 507 | vector(size_type __n, const allocator_type& __a = allocator_type()) | ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/9/bits/stl_vector.h:494:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector(const allocator_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::allocator_type = std::allocator<int>]' 494 | vector(const allocator_type& __a) _GLIBCXX_NOEXCEPT | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:494:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/9/bits/stl_vector.h:484:7: note: candidate: 'std::vector<_Tp, _Alloc>::vector() [with _Tp = int; _Alloc = std::allocator<int>]' 484 | vector() = default; | ^~~~~~ /usr/include/c++/9/bits/stl_vector.h:484:7: note: candidate expects 0 arguments, 2 provided vision.cpp:57:19: error: 'add_and' was not declared in this scope 57 | al.pb(add_and({p0[s], tot0[s+K]})); | ^~~~~~~ vision.cpp:60:19: error: 'add_and' was not declared in this scope 60 | al.pb(add_and({p1[s], tot0[s+K]})); | ^~~~~~~ vision.cpp:63:18: error: 'add_or' was not declared in this scope 63 | nk = add_or(al); | ^~~~~~ vision.cpp:66:17: error: 'nk' was not declared in this scope; did you mean 'nk1'? 66 | add_or({nk, nk}); | ^~ | nk1 vision.cpp:66:9: error: 'add_or' was not declared in this scope 66 | add_or({nk, nk}); | ^~~~~~ vision.cpp:69:18: error: 'nk' was not declared in this scope; did you mean 'nk1'? 69 | add_xor({nk, nk1}); | ^~ | nk1 vision.cpp:69:9: error: 'add_xor' was not declared in this scope 69 | add_xor({nk, nk1}); | ^~~~~~~