Submission #245635

# Submission time Handle Problem Language Result Execution time Memory
245635 2020-07-07T02:23:19 Z Dormi Vision Program (IOI19_vision) C++14
Compilation error
0 ms 0 KB
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
template<typename T>
int sz(const T &a){return (int)a.size();}
int h,w,k,n;
vector<int> arr[2],parr[2],sarr[2];
int teans[2][2];
int cp(int x, int y){
    return (x+y)/2*w+(y-x)/2;
}
int check(int rot, int dist){
    vector<int> te;
    for(int i=0;i+dist<n;i++){
        te.push_back(add_and({parr[rot][i],sarr[rot][i+dist]}));
    }
    if(sz(te)==0){
        for(int i=0;i<h*w;i++)te.push_back(i);
        return add_xor(te);
    }
    return add_or(te);
}
void construct_network(int H, int W, int K){
    h=H,w=W,k=K;
    for(int rot=0;rot<=1;rot++) {
        int l = (rot?0:w - 1), r = (rot?0:w - 1);
        for (int i = (rot?0:-(w - 1)); i <= (rot?h-1+w-1:h - 1); i++) {
            vector<int> te;
            for (int j = l; j <= r; j += 2) {
                te.push_back(rot?cp(j,i):cp(i, j));
            }
            arr[rot].push_back(add_or(te));
            if (i >= (rot?w-1:-(w - 1) + (w - 1)))l += 1;
            else l -= 1;
            if (i >= (rot?h-1:-(w - 1) + (h - 1)))r -= 1;
            else r += 1;
        }
        n = sz(arr[rot]);
        parr[rot].push_back(add_or({arr[rot][0]}));
        for (int i = 1; i < n; i++) {
            parr[rot].push_back(add_or({parr[rot].back(), arr[rot][i]}));
        }
        sarr[rot].resize(n);
        sarr[rot][n - 1] = add_or({arr[rot].back()});
        for (int i = n - 2; i >= 0; i--) {
            sarr[rot][i]=add_or({sarr[rot][i + 1], arr[rot][i]});
        }
        teans[rot][0] = check(rot, k + 1), teans[rot][1] = check(rot, k);
    }
    int bad=add_or({teans[0][0],teans[1][0]}),good=add_or({teans[0][1],teans[1][1]});
    add_xor({bad,good});
}

Compilation message

vision.cpp: In function 'int check(int, int)':
vision.cpp:17:22: error: 'add_and' was not declared in this scope
         te.push_back(add_and({parr[rot][i],sarr[rot][i+dist]}));
                      ^~~~~~~
vision.cpp:21:16: error: 'add_xor' was not declared in this scope
         return add_xor(te);
                ^~~~~~~
vision.cpp:23:12: error: 'add_or' was not declared in this scope
     return add_or(te);
            ^~~~~~
vision.cpp:23:12: note: suggested alternative: 'rand_r'
     return add_or(te);
            ^~~~~~
            rand_r
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:34:32: error: 'add_or' was not declared in this scope
             arr[rot].push_back(add_or(te));
                                ^~~~~~
vision.cpp:34:32: note: suggested alternative: 'rand_r'
             arr[rot].push_back(add_or(te));
                                ^~~~~~
                                rand_r
vision.cpp:41:29: error: 'add_or' was not declared in this scope
         parr[rot].push_back(add_or({arr[rot][0]}));
                             ^~~~~~
vision.cpp:41:29: note: suggested alternative: 'rand_r'
         parr[rot].push_back(add_or({arr[rot][0]}));
                             ^~~~~~
                             rand_r
vision.cpp:52:13: error: 'add_or' was not declared in this scope
     int bad=add_or({teans[0][0],teans[1][0]}),good=add_or({teans[0][1],teans[1][1]});
             ^~~~~~
vision.cpp:52:13: note: suggested alternative: 'rand_r'
     int bad=add_or({teans[0][0],teans[1][0]}),good=add_or({teans[0][1],teans[1][1]});
             ^~~~~~
             rand_r
vision.cpp:53:18: error: 'good' was not declared in this scope
     add_xor({bad,good});
                  ^~~~
vision.cpp:53:18: note: suggested alternative: 'fmod'
     add_xor({bad,good});
                  ^~~~
                  fmod
vision.cpp:53:5: error: 'add_xor' was not declared in this scope
     add_xor({bad,good});
     ^~~~~~~