Submission #572938

# Submission time Handle Problem Language Result Execution time Memory
572938 2022-06-05T14:17:30 Z SlavicG Vision Program (IOI19_vision) C++17
12 / 100
9 ms 1108 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){}
*/
 
void construct_network(int H, int W, int K) {
    vector<int> indices;

    if(K == 1 && min(H, W) != 1) {
        vector<int> rowsOR, colsOR;
        map<int, int> rr, cc;
        for(int i = 0; i < H; ++i) {
            vector<int> ele;
            for(int j = 0; j < W; ++j) {
                ele.pb(i * W + j);
            }
            rowsOR.pb(add_or(ele));
            rr[i] = rowsOR.back();
        }
        for(int i = 0; i < W; ++i) {
            vector<int> ele;
            for(int j = 0; j < H; ++j) {
                ele.pb(j * W + i);
            }
            colsOR.pb(add_or(ele));
            cc[i] = colsOR.back();
        }
        vector<int> rrr, ccc;
        for(int i = 0; i + 1 < H; ++i) {
            rrr.pb(add_and({rr[i], rr[i + 1]}));
        }
        for(int i = 0; i + 1 < W; ++i) {
            ccc.pb(add_and({cc[i], cc[i + 1]}));
        }

        int xorRows = add_xor(rowsOR);
        int xorCols = add_xor(colsOR);

        int val1 = add_and({add_or(rrr), add_not(xorCols)});
        int val2 = add_and({add_or(ccc), add_not(xorRows)});
        add_or({val1, val2});
        return;
    }

    if(max(H, W) <= 10 || min(H, W) == 1) {
        set<array<int, 4>> vis;
        for(int i = 0; i < H; ++i) {
            for(int j = 0; j < W; ++j) {
                for(int x = 0; x < H; ++x) {
                    for(int y = 0; y < W; ++y) {
                        if(x == i && j == y) continue;
                        if(abs(x - i) + abs(y - j) != K) continue;
                        vis.insert({i, j, x, y});
                        vis.insert({x, y, i, j});
                        vector<int> purice = {i * W + j, x * W + y};
                        sort(all(purice));
                        indices.pb(add_and(purice));
                    }   
                }
            }
        }
        if(sz(indices) == 0) {
            vector<int> bruh;
            for(int i = 0; i < H * W; ++i) bruh.pb(i);
            add_and(bruh);
            return;
        }
        add_or(indices);
        return;
    } else {
        vector<int> Paiu;
        for(int i = 0; i < H; ++i) {
            for(int j = 0; j < W; ++j) {
                if(i + j != K) continue;
                if(i == 0 && j == 0) continue;
                Paiu.pb(add_and({0, i * W + j}));
            }
        }
        add_or(Paiu);
        return;
    }
}

/*
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 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
# 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 9 ms 1108 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 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Incorrect 1 ms 212 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
6 Halted 0 ms 0 KB -