Submission #203868

# Submission time Handle Problem Language Result Execution time Memory
203868 2020-02-22T18:09:04 Z medk Vision Program (IOI19_vision) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "vision.h"

#define pb push_back
#define ll long long
#define x first
#define y second

using namespace std;

int h,w;

int id(int y, int x)
{
    return y*w+x;
}

void construct_network(int H, int W, int k)
{
    h=H, w=W;
    vector<int> orY, orX, orT, orB;
    for(int i=0;i<h;i++)
    {
        vector<int> ln;
        for(int j=0;j<w;j++) ln.pb(id(i,j));
        orY.pb(add_or(ln));
    }
    for(int i=0;i<w;i++)
    {
        vector<int> ln;
        for(int j=0;j<h;j++) ln.pb(id(j,i));
        orX.pb(add_or(ln));
    }
    for(int i=0;i<h+w-1;i++)
    {
        vector<int> ln,ln2;
        for(int j=0;j<=i;j++) ln.pb(id(i-j,j)), ln2.pb(h-1-i+j,j);
        orT.pb(add_or(ln)), orB.pb(add_or(ln2));
    }
    vector<int> poss;
    for(int i=0;i<h+w-1-k;i++)
        poss.pb(add_and(vector<int>{orT[i], orT[i+k]})), poss.pb(add_and(vector<int>{orB[i], orB[i+k]}));
    int fst=add_or(poss);
    vector<int> wishnot;
    vector<int> wb,hb;
    for(int i=w-1;i>=k;i--) wb.pb(orX[i]);
    for(int i=0;i<w-k-1;i++)
    {
        wb.pop_back();
        int tmpor=add_or(wb);
        wishnot.pb(add_and(vector<int>{orX[i],tmpor}));
    }
    for(int i=h-1;i>=k;i--) hb.pb(orY[i]);
    for(int i=0;i<h-k-1;i++)
    {
        hb.pop_back();
        int tmpor=add_or(hb);
        wishnot.pb(add_and(vector<int>{orY[i],tmpor}));
    }
    int tm=add_or(wishnot);
    int wishn=add_not(tm);
    add_and(vector<int>{wishn,fst});
    return;
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:37:65: error: no matching function for call to 'std::vector<int>::push_back(int, int&)'
         for(int j=0;j<=i;j++) ln.pb(id(i-j,j)), ln2.pb(h-1-i+j,j);
                                                                 ^
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: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, 2 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, 2 provided