Submission #574298

# Submission time Handle Problem Language Result Execution time Memory
574298 2022-06-08T10:01:13 Z SlavicG Vision Program (IOI19_vision) C++17
0 / 100
12 ms 1496 KB
#include "vision.h"
#include "bits/stdc++.h"
using namespace std;
 
#define ll long long
 
#define       forn(i,n)              for(int i=0;i<n;i++)
#define          all(v)              v.begin(), v.end()
#define         rall(v)              v.rbegin(),v.rend()
 
#define            pb                push_back
#define          sz(a)               (int)a.size()
 
/*
int add_not(int N){}
int add_and(vector<int> Ns){}
int add_or(vector<int> Ns){}
int add_xor(vector<int> Ns){}
*/

const int S = 10;

void construct_network(int H, int W, int K) {
    vector<int> rowXOR(H), colXOR(W);
    forn(i, H) {
        vector<int> vals;
        forn(j, W) vals.pb(i * W + j);
        rowXOR.pb(add_xor(vals));
    }
    forn(i, W) {
        vector<int> vals;
        forn(j, H) vals.pb(j * W + i);
        colXOR.pb(add_xor(vals));
    }

    vector<int> q, q1;
    for(int i = 0; i < H; ++i) {
        q.pb(rowXOR[i]);
        q1.pb(add_xor(q));
    }
    int zero;
    if(H * W > 2) {
        zero = add_and({0, 1, 2});
    } else zero = add_not(0);

    vector<int> bx(S, zero), by(S, zero);

    int idx = 0;
    while(true) {
        q = q1;
        bx[idx] = add_xor(q);
        if(sz(q) == 1) break;
        q1.clear();
        for(int i = 0; i + 1 < sz(q); i += 2) {
            int val1 = add_and({q[i], q[i + 1]});
            int val2 = add_or({q[i], q[i + 1]});
            int val3 = add_not(q[i]);
            int val4 = add_not(val1);
            int val6 = add_not(bx[idx]);
            int val5 = add_and({val2, val3, val4, val6});
            q1.pb(add_or({val5, val1}));
        }
    }

    q.clear();
    q1.clear();

    for(int i = 0; i < W; ++i) {
        q.pb(colXOR[i]);
        q1.pb(add_xor(q));
    }
    idx = 0;
    while(true) {
        q = q1;
        by[idx] = add_xor(q);
        if(sz(q) == 1) break;
        q1.clear();
        for(int i = 0; i + 1 < sz(q); i += 2) {
            int val1 = add_and({q[i], q[i + 1]});
            int val2 = add_or({q[i], q[i + 1]});
            int val3 = add_not(q[i]);
            int val4 = add_not(val1);
            int val6 = add_not(bx[idx]);
            int val5 = add_and({val2, val3, val4, val6});
            q1.pb(add_or({val5, val1}));
        }
    }

    int temp = zero;

    vector<int> b(S, zero);
    for(int i = 0; i < S; ++i) {
        b[i] = add_xor({temp, bx[i], by[i]});
        temp = add_or({add_and({temp, bx[i]}), add_and({temp, by[i]}), add_and({bx[i], by[i]})});
        if(!(K & (1 << i))) {
            b[i] = add_not(b[i]);    
        }
    }
    add_and(b);
}

/*

void solve() {  
    
} 
     
int32_t main() {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t = 1;
    //cin >> t;
    while(t--) {
        solve();
    }
} 
 
*/
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 468 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 1496 KB on inputs (80, 199), (81, 199), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -