답안 #241699

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
241699 2020-06-25T09:38:10 Z abacaba Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <chrono>
#include <vector>
#include <map>
#include <random>
#include <set>
#include <algorithm>
#include <math.h>
#include <cstdio>
#include <stdio.h>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <deque>
#include <cassert>
#include <stack>
using namespace std;
 
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ppb pop_back
#define emb emplace_back
#define ll long long
#define ull unsigned long long
#define cntbit(x) __builtin_popcount(x)
#define endl '\n'
#define uset unordered_set
#define umap unordered_map
#define pii pair<int, int>
#define ld long double
#define pll pair<long long, long long>
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template <typename T> inline T range(T l, T r) {
    return uniform_int_distribution<T>(l, r)(rng);
}
 
inline void setin(string s) {
    freopen(s.c_str(), "r", stdin);
}
 
inline void setout(string s) {
    freopen(s.c_str(), "w", stdout);
}
 
template <typename T> void Min(T &a, T b) {
    a = min(a, b);
}
 
template <typename T> void Max(T &a, T b) {
    a = max(a, b);
}
 
const int inf = 2e9;
const int mod = 998244353;
const int N = 3e5 + 15;

int n, m, k;

inline int ind(int i, int j, int W) {
    return i * W + j;
}

inline bool lie(int l, int x, int r) {
    return l <= x && x <= r;
}

int check(vector <int> a, int k) {
    vector <int> tmp = {};
    for(int i = 0; i + k - 1 < a.size(); ++i) {
        vector <int> now = {};
        for(int j = i; j < i + k; ++j)
            now.pb(a[j]);
        tmp.pb(add_xor({add_or(now), add_xor(now)}));
    }
    return add_or(tmp);
}

int consider(vector <int> a, vector <int> b, int k) {
    int res = add_xor({check(a, k + 1), check(a, k)});
    return add_and({res, check(b, k + 1)});
}

void construct_network(int H, int W, int K) {
    vector <int> a, b;
    n = H, m = W, k = K;
    for(int d = 0; d <= n + m - 2; ++d) {
        vector <int> now = {};
        for(int i = 0; i < n; ++i) {
            int j = d - i;
            if(lie(0, j, m - 1))
                now.pb(ind(i, j, m));
        }
        a.pb(add_or(now));
    }
    for(int d = -m + 1; d <= n - 1; ++d) {
        vector <int> now = {};
        for(int i = 0; i < n; ++i) {
            int j = i - d;
            if(lie(0, j, m - 1))
                now.pb(ind(i, j, m));
        }
        b.pb(add_or(now));
    }
    add_or({consider(a, b, k), consider(b, a, k)});
}

Compilation message

vision.cpp: In function 'int check(std::vector<int>, int)':
vision.cpp:77:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i + k - 1 < a.size(); ++i) {
                    ~~~~~~~~~~^~~~~~~~~~
vision.cpp:81:25: error: 'add_or' was not declared in this scope
         tmp.pb(add_xor({add_or(now), add_xor(now)}));
                         ^~~~~~
vision.cpp:81:25: note: suggested alternative: 'rand_r'
         tmp.pb(add_xor({add_or(now), add_xor(now)}));
                         ^~~~~~
                         rand_r
vision.cpp:81:38: error: 'add_xor' was not declared in this scope
         tmp.pb(add_xor({add_or(now), add_xor(now)}));
                                      ^~~~~~~
vision.cpp:81:16: error: 'add_xor' was not declared in this scope
         tmp.pb(add_xor({add_or(now), add_xor(now)}));
                ^~~~~~~
vision.cpp:83:12: error: 'add_or' was not declared in this scope
     return add_or(tmp);
            ^~~~~~
vision.cpp:83:12: note: suggested alternative: 'rand_r'
     return add_or(tmp);
            ^~~~~~
            rand_r
vision.cpp: In function 'int consider(std::vector<int>, std::vector<int>, int)':
vision.cpp:87:15: error: 'add_xor' was not declared in this scope
     int res = add_xor({check(a, k + 1), check(a, k)});
               ^~~~~~~
vision.cpp:88:12: error: 'add_and' was not declared in this scope
     return add_and({res, check(b, k + 1)});
            ^~~~~~~
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:101:14: error: 'add_or' was not declared in this scope
         a.pb(add_or(now));
              ^~~~~~
vision.cpp:101:14: note: suggested alternative: 'rand_r'
         a.pb(add_or(now));
              ^~~~~~
              rand_r
vision.cpp:110:14: error: 'add_or' was not declared in this scope
         b.pb(add_or(now));
              ^~~~~~
vision.cpp:110:14: note: suggested alternative: 'rand_r'
         b.pb(add_or(now));
              ^~~~~~
              rand_r
vision.cpp:112:5: error: 'add_or' was not declared in this scope
     add_or({consider(a, b, k), consider(b, a, k)});
     ^~~~~~
vision.cpp:112:5: note: suggested alternative: 'rand_r'
     add_or({consider(a, b, k), consider(b, a, k)});
     ^~~~~~
     rand_r