Submission #289832

# Submission time Handle Problem Language Result Execution time Memory
289832 2020-09-03T06:28:00 Z arman_ferdous Vision Program (IOI19_vision) C++17
12 / 100
15 ms 1664 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std;

const int N = 401;

int H, W, K;

vector<int> getdia1(int r, int c) {
    vector<int> cells;
    for(;;) {
        cells.push_back(r * W + c);
        r--, c++;
        if(r < 0 || c >= W) break;
    }
    return cells;
}

int dia1[N + N], dia2[N + N];
int prefix1[N + N], prefix2[N + N];

void construct_network(int h, int w, int k) {
    H = h, W = w, K = k;

    for(int i = 0; i < h; i++) {
        vector<int> cells = getdia1(i, 1);
        dia1[i + 1] = add_xor(cells);
    }
    for(int j = 1; j < w; j++) {
        vector<int> cells = getdia1(h - 1, j);
        dia1[h - 1 + j] = add_xor(cells);
    }
    for(int i = 0; i < h + w - 1; i++) {
        vector<int> tmp;
        for(int j = 0; j <= i; j++) tmp.push_back(dia1[j]);
        prefix1[i] = add_xor(tmp);
    }
    vector<int> KKdifres, Kdifres;
    for(int i = 0; i + K < h + w - 1; i++) {
        vector<int> tmp(2); 
        tmp[0] = prefix1[i];
        tmp[1] = prefix1[i + K];
        KKdifres.push_back(add_and(tmp));
    }
    for(int i = 0; i + K - 1 < h + w - 1; i++) {
        vector<int> tmp(2);
        tmp[0] = prefix1[i];
        tmp[1] = prefix1[i + K - 1];
        Kdifres.push_back(add_and(tmp));
    }
    int greaterthanK = add_or(Kdifres);
    int greaterthanKK = add_or(KKdifres);

    vector<int> tmp(2); 
    tmp[0] = greaterthanK;
    tmp[1] = greaterthanKK;
    int result1 = add_xor(tmp);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:57:9: warning: unused variable 'result1' [-Wunused-variable]
   57 |     int result1 = add_xor(tmp);
      |         ^~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Incorrect 0 ms 256 KB on inputs (0, 0), (1, 0), expected 1, but computed 0
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Incorrect 0 ms 256 KB on inputs (0, 0), (1, 0), expected 1, but computed 0
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Incorrect 0 ms 256 KB on inputs (0, 0), (1, 0), expected 1, but computed 0
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Incorrect 0 ms 256 KB on inputs (0, 0), (1, 0), expected 1, but computed 0
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 512 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 3 ms 512 KB Output is correct
4 Correct 3 ms 512 KB Output is correct
5 Correct 3 ms 512 KB Output is correct
6 Correct 3 ms 512 KB Output is correct
7 Correct 3 ms 512 KB Output is correct
8 Correct 3 ms 544 KB Output is correct
9 Correct 3 ms 512 KB Output is correct
10 Correct 3 ms 544 KB Output is correct
11 Correct 3 ms 512 KB Output is correct
12 Correct 3 ms 512 KB Output is correct
13 Correct 3 ms 512 KB Output is correct
14 Correct 3 ms 512 KB Output is correct
15 Correct 3 ms 512 KB Output is correct
16 Correct 3 ms 512 KB Output is correct
17 Correct 3 ms 512 KB Output is correct
18 Correct 3 ms 512 KB Output is correct
19 Correct 3 ms 512 KB Output is correct
20 Correct 3 ms 512 KB Output is correct
21 Correct 1 ms 256 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB on inputs (0, 0), (1, 0), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 1664 KB on inputs (96, 130), (143, 84), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Incorrect 0 ms 256 KB on inputs (0, 0), (1, 0), expected 1, but computed 0
6 Halted 0 ms 0 KB -