Submission #1270055

#TimeUsernameProblemLanguageResultExecution timeMemory
1270055biankVision Program (IOI19_vision)C++20
100 / 100
11 ms2496 KiB
#include "vision.h"
#include <bits/stdc++.h>
 
using namespace std;
 
#define forsn(i, s, n) for (int i = int(s); i < int(n); i++)
#define forn(i, n) forsn(i, 0, n)
#define dforsn(i, s, n) for (int i = int(n) - 1; i >= int(s); i--)
#define dforn(i, n) dforsn(i, 0, n)
 
using vi = vector<int>;

#define sz(x) int(x.size())
#define all(x) begin(x), end(x)

#define pb push_back

void construct_network(int H, int W, int K) {
    vi row(H), col(W);
    forn(i, H) {
        vi r;
        forn(j, W) r.pb(i * W + j);
        row[i] = add_or(r);
    }
    forn(j, W) {
        vi c;
        forn(i, H) c.pb(i * W + j);
        col[j] = add_or(c);
    }
    vi toAdd;
    forsn(i, 1, H) {
        vi left, right;
        forn(j, i) left.pb(row[j]);
        forsn(j, i, H) right.pb(row[j]);
        toAdd.pb(add_and(vi{add_or(left), add_or(right)}));
    }
    forsn(i, 1, W) {
        vi left, right;
        forn(j, i) left.pb(col[j]);
        forsn(j, i, W) right.pb(col[j]);
        toAdd.pb(add_and(vi{add_or(left), add_or(right)}));
    }
    const int ZERO = add_and(vi{0, add_not(0)});
    const int ONE = add_not(ZERO);
    vi sum(9, ZERO);
    for (int x : toAdd) {
        forn(i, 9) {
            int carry = add_and(vi{sum[i], x});
            sum[i] = add_xor(vi{sum[i], x});
            x = carry;
        }
    }
    int ret = ONE;
    forn(i, 9) {
        if (K >> i & 1) ret = add_and(vi{ret, sum[i]});
        else ret = add_and(vi{ret, add_not(sum[i])});
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...