답안 #427176

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
427176 2021-06-14T13:09:06 Z Aldas25 Vision Program (IOI19_vision) C++14
26 / 100
13 ms 1408 KB
#include "vision.h"
#include <bits/stdc++.h>

using namespace std;

#define FAST_IO ios_base::sync_with_stdio(0); cin.tie(nullptr)
#define FOR(i, a, b) for (int i = (a); i <= (b); i++)
#define REP(n) FOR(O, 1, (n))
#define f first
#define s second
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef vector<ll> vl;

const int MAXN = 500100;

int h, w, k;

int getId (int i, int j) {
    return i*w + j;
}

void construct_network(int H, int W, int K) {
    h = H, w = W, k = K;

    /// 0..H*W-1 - grid

    vi istr1, istr2;
    FOR(i, 0, h+w-2) {
        int x, y;
        if (i < w) {
            x = 0;
            y = w - i - 1;
        } else {
            y = 0;
            x = i - w + 1;
        }
        vi ids;
        while (x < h && y < w) {
            ids.pb(getId(x, y));
            x++; y++;
        }

        //cout << " istr i = " << i << ": ";
        //for (int x : ids) cout << x << " ";
        //cout << endl;

        int id = add_or(ids);
        //cout << " id = " << id << endl;
        istr1.pb(id);
    }

    FOR(i, 0, h+w-2) {
        int x, y;
        if (i < h) {
            x = i;
            y = 0;
        } else {
            x = h-1;
            y = i - x;
        }
        vi ids;
        while (x >= 0 && y < w) {
            ids.pb(getId(x, y));
            x--; y++;
        }

        //cout << " istr i = " << i << ": ";
        //for (int x : ids) cout << x << " ";
        //cout << endl;

        int id = add_or(ids);
        //cout << " id = " << id << endl;
        istr2.pb(id);
    }

    vi istrPairs1, istrPairs2;
    FOR(i, 0, (int)istr1.size()-k-1) {
        vi toAnd = {istr1[i], istr1[i+k]};
        int id = add_and(toAnd);
        istrPairs1.pb(id);
    }

    int pairs1 = add_or(istrPairs1);

    FOR(i, 0, (int)istr2.size()-k-1) {
        vi toAnd = {istr2[i], istr2[i+k]};
        int id = add_and(toAnd);
        istrPairs2.pb(id);
    }

    int pairs2 = add_or(istrPairs2);

    vi groups1;
    FOR(i, 0, (int)istr1.size()-1) {
        vi ids;
        FOR(j, max(0, i-k), min((int)istr1.size()-1, i+k))
            ids.pb(istr1[j]);
        int id = add_xor(ids);
        id = add_not(id);
        vi toAnd = {id, istr1[i]};
        id = add_and(toAnd);
        groups1.pb(id);
    }

    vi groups2;
    FOR(i, 0, (int)istr2.size()-1) {
        vi ids;
        FOR(j, max(0, i-k), min((int)istr2.size()-1, i+k))
            ids.pb(istr2[j]);
        int id = add_xor(ids);
        id = add_not(id);
        vi toAnd = {id, istr2[i]};
        id = add_and(toAnd);
        groups2.pb(id);
    }

    int gr1 = add_or(groups1);
    int gr2 = add_or(groups2);

    vi toAnd1 = {pairs1, gr2};
    vi toAnd2 = {pairs2, gr1};
    int id1 = add_and(toAnd1);
    int id2 = add_and(toAnd2);
    vi toOr = {id1, id2};
    add_or(toOr);

}

/*

2 3 3
0 0 0 1
0 0 0 2
0 0 1 0
0 0 1 1
0 0 1 2
0 1 0 2
0 1 1 0
0 1 1 1
0 1 1 2
0 2 1 0
0 2 1 1
0 2 1 2
1 0 1 1
1 0 1 2
1 1 1 2
-1
out:
0
0
0
0
1
0
0
0
0
1
0
0
0
0
0




in:
2 3 1
0 0 0 1
0 0 0 2
0 0 1 0
0 0 1 1
0 0 1 2
0 1 0 2
0 1 1 0
0 1 1 1
0 1 1 2
0 2 1 0
0 2 1 1
0 2 1 2
1 0 1 1
1 0 1 2
1 1 1 2
-1
out:


2 3 1
0 2 1 0
-1

*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 460 KB Output is correct
2 Correct 8 ms 844 KB Output is correct
3 Correct 12 ms 844 KB Output is correct
4 Correct 13 ms 972 KB Output is correct
5 Correct 3 ms 460 KB Output is correct
6 Correct 10 ms 768 KB Output is correct
7 Correct 9 ms 972 KB Output is correct
8 Correct 10 ms 972 KB Output is correct
9 Correct 2 ms 332 KB Output is correct
10 Correct 7 ms 684 KB Output is correct
11 Correct 11 ms 908 KB Output is correct
12 Correct 8 ms 844 KB Output is correct
13 Correct 13 ms 972 KB Output is correct
14 Correct 10 ms 1036 KB Output is correct
15 Correct 2 ms 332 KB Output is correct
16 Correct 8 ms 716 KB Output is correct
17 Correct 8 ms 808 KB Output is correct
18 Correct 12 ms 844 KB Output is correct
19 Correct 10 ms 972 KB Output is correct
20 Correct 11 ms 972 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB on inputs (0, 0), (1, 1), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 1356 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 3 ms 460 KB Output is correct
4 Correct 4 ms 460 KB Output is correct
5 Correct 2 ms 460 KB Output is correct
6 Correct 2 ms 460 KB Output is correct
7 Correct 8 ms 844 KB Output is correct
8 Correct 7 ms 844 KB Output is correct
9 Correct 12 ms 1408 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 296 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Incorrect 1 ms 204 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -