답안 #1019091

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1019091 2024-07-10T13:19:13 Z ProtonDecay314 Vision Program (IOI19_vision) C++17
0 / 100
1 ms 1496 KB
// AM+DG

/*

*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
#define L(i, varmn, varmx) for(ll i = varmn; i < varmx; i++)
#define LR(i, varmx, varmn) for(ll i = varmx; i > varmn; i--)
#define LI(i, varmn, varmx) for(int i = varmn; i < varmx; i++)
#define LIR(i, varmx, varmn) for(int i = varmx; i > varmn; i--)
#define pb push_back
#include "vision.h"

int cellnum(int r, int c, int W) {
    return r * W + c;
}

void construct_network(int h, int w, int k) {
    // Falsy/truthy values, may help!
    // int falsy = add_xor({0, 0});
    // int truthy = add_not(falsy);

    // Row/col stuff
    vi row_has;
    LI(i, 0, h) {
        vi all_in_row;
        LI(j, 0, w) {
            all_in_row.pb(cellnum(i, j, w));
        }
        row_has.pb(add_or(all_in_row));
    }
    vi col_has;
    LI(i, 0, w) {
        vi all_in_col;
        LI(j, 0, h) all_in_col.pb(cellnum(j, i, w));
        col_has.pb(add_or(all_in_col));
    }

    int row_is_same = add_xor(row_has);
    int col_is_same = add_xor(col_has);

    // r + c = k
    // r = k - c
    // 1 <= r <= w - 1;
    // 1 <= k - c <= w - 1;
    // k - 1 >= c >= k - w + 1;
    // k - 1 >= r >= k - h + 1;
    
    // Iterate through rows
    vi sep_by_row;
    // LI(i, 0, max(k - h + 1, 0)) sep_by_row.pb(-1);
    // LI(i, max(k - h + 1, 0), min(w - 1, k) + 1) {
    LI(i, 0, h - 1) {
        vi to_or;
        LI(j, 0, h - i) {
            to_or.pb(add_and({row_has[j], row_has[j + i]}));
        }
        sep_by_row.pb(add_or(to_or));
    }

    // Iterate through columns

    // cout << max(k - w + 1, 0) << " " << min(h - 1, k) << " " << max(k - h + 1, 0) << " " << min(w - 1, k) << endl;
    vi sep_by_col;
    // LI(i, 0, max(k - w + 1, 0)) sep_by_col.pb(-1);
    // LI(i, max(k - w + 1, 0), min(h - 1, k) + 1) {
    LI(i, 0, w - 1) {
        vi to_or;
        LI(j, 0, w - i) {
            to_or.pb(add_and({col_has[j], col_has[j + i]}));
        }
        sep_by_col.pb(add_or(to_or));
    }

    // ORing the possible separations
    vi final_to_or;

    // LI(i, max(k - h + 1, 1), min(w - 1, k - 1) + 1) {
    LI(i, 1, k) {
        if(i < w && k - i < h) {
            final_to_or.pb(add_and({sep_by_col[i], sep_by_row[k - i]}));
        }
    }

    if(k < h) {
        final_to_or.pb(add_and({sep_by_row[k], col_is_same}));
    }

    if(k < w) {
        final_to_or.pb(add_and({row_is_same, sep_by_col[k]}));
    }
    // cout << final_to_or.size() << endl;

    add_or(final_to_or);

    return;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB WA in grader: Invalid index
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB WA in grader: Invalid index
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB WA in grader: Invalid index
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB WA in grader: Invalid index
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1240 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 436 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1496 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB WA in grader: Invalid index
3 Halted 0 ms 0 KB -