Submission #239117

# Submission time Handle Problem Language Result Execution time Memory
239117 2020-06-14T13:10:54 Z zoooma13 Vision Program (IOI19_vision) C++14
0 / 100
20 ms 2048 KB
#include <bits/stdc++.h>
#include "vision.h"
//#include "grader.cpp"
using namespace std;

int h ,w ,k;
int d(int i ,int j){ return i*w+j; }
int dist(int r ,int c ,int i ,int j){
    return abs(r-i) + abs(j-c);
}

void construct_network(int H, int W, int K) { h=H ,w=W ,k=K;
    int id = h*w;
    vector <int> rowOr(h) ,rowXor(h);
    for(int i=0; i<h; i++){
        vector <int> r;
        for(int j=0; j<w; j++)
            r.push_back(d(i ,j));
        add_or(r);
        rowOr[i] = id++;
        add_xor(r);
        rowXor[i] = id++;
    }
    vector <int> colOr(w) ,colXor(w);
    for(int j=0; j<w; j++){
        vector <int> c;
        for(int i=0; i<h; i++)
            c.push_back(d(i ,j));
        add_or(c);
        colOr[j] = id++;
        add_xor(c);
        colXor[j] = id++;
    }

    add_or(rowXor);
    int OrAllRowsXor = id++;
    add_not(OrAllRowsXor);
    int notOrAllRowsXor = id++;

    add_or(colXor);
    int OrAllColsXor = id++;
    add_not(OrAllColsXor);
    int notOrAllColsXor = id++;

    vector <int> rowsAnd(h-1);
    for(int i=1; i<h; i++){
        add_and({rowOr[i-1] ,rowOr[i]});
        rowsAnd[i-1] = id++;
    }
    vector <int> colsAnd(w-1);
    for(int i=1; i<w; i++){
        add_and({colOr[i-1] ,colOr[i]});
        colsAnd[i-1] = id++;
    }

    //(!OrAllColsXor && OrAllRowsAnd) || (!OrAllRowsXor && OrAllColsAnd)

    add_or(rowsAnd);
    int OrAllRowsAnd = id++;

    add_or(colsAnd);
    int OrAllColsAnd = id++;

    add_and({OrAllRowsAnd ,notOrAllColsXor}) ,id++;
    add_and({OrAllColsAnd ,notOrAllRowsXor}) ,id++;
    add_or({id-2 ,id-1});
}
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 5 ms 384 KB Output is correct
2 Incorrect 4 ms 384 KB on inputs (0, 0), (0, 1), expected 0, but computed 1
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 20 ms 2048 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 6 ms 384 KB Output is correct
4 Correct 7 ms 512 KB Output is correct
5 Incorrect 5 ms 384 KB WA in grader: Instruction with no inputs
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -