답안 #427082

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
427082 2021-06-14T12:16:39 Z Aldas25 Vision Program (IOI19_vision) C++14
14 / 100
11 ms 1100 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 istr;
    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;
        istr.pb(id);
    }

    vi istrPairs;
    FOR(i, 0, (int)istr.size()-2) {
        vi toAnd = {istr[i], istr[i+1]};
        int id = add_and(toAnd);
        istrPairs.pb(id);
    }

    int id1 = add_or(istrPairs);


    //vi istr;
    istr.clear();
    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;
        istr.pb(id);
    }

    //vi istrPairs;
    istrPairs.clear();
    FOR(i, 0, (int)istr.size()-2) {
        vi toAnd = {istr[i], istr[i+1]};
        int id = add_and(toAnd);
        istrPairs.pb(id);
    }

    int id2 = add_or(istrPairs);

    vi toAnd = {id1, id2};
    add_and(toAnd);
}

/*

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:


*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Incorrect 1 ms 332 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 296 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 1100 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 3 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 7 ms 680 KB Output is correct
8 Correct 6 ms 716 KB Output is correct
9 Correct 11 ms 1100 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 288 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), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -