Submission #721543

# Submission time Handle Problem Language Result Execution time Memory
721543 2023-04-11T04:03:55 Z nguyentunglam Vision Program (IOI19_vision) C++17
0 / 100
39 ms 3488 KB
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
const int N = 400 + 10;
int a[N][N], row[N], col[N], rowx[N], colx[N];
void construct_network(int h, int w, int k) {
    int n = 0, m = 0;
    for(int i = 0; i <= 400; i++) for(int j = 0; j <= 400; j++) a[i][j] = -1;
    for(int i = 0; i < h; i++) for(int j = 0; j < w; j++) {
        a[i - j + w - 1][i + j] = i * w + j;
        n = max(n, i - j + w - 1);
        m = max(m, i + j);
    }
    n++; m++;
    for(int i = 0; i < n; i++) {
        for(int j = 0; j < m; j++) cout << a[i][j] << " ";
        cout << endl;
    }

    for(int i = 0; i < n; i++) {
        vector<int> ask;
        for(int j = 0; j < m; j++) if (a[i][j] != -1) ask.push_back(a[i][j]);
        row[i] = add_or(ask);
        rowx[i] = add_xor(ask);
    }

    for(int j = 0; j < m; j++) {
        vector<int> ask;
        for(int i = 0; i < n; i++) if (a[i][j] != -1) {
            ask.push_back(a[i][j]);
        }
        col[j] = add_or(ask);
        colx[j] = add_xor(ask);
    }

    vector<int> lst, R, C;

    for(int i = k; i < n; i++) R.push_back(add_and({row[i], row[i - k]}));
    for(int j = k; j < m; j++) {
        vector<int> ask1, ask2;
        for(int l = j; l >= j - k; l--) {
            ask1.push_back(col[l]);
            ask2.push_back(colx[l]);
        }
        int tmp1 = add_or(ask1);
        int tmp2 = add_not(add_xor(ask2));
        C.push_back(add_and({tmp1, tmp2}));
    }

    if (!R.empty() && !C.empty()) {
        int p1 = add_or(R);
        int p2 = add_or(C);
        lst.push_back(add_and({p1, p2}));
    }

    R.clear(); C.clear();

    for(int j = k; j < m; j++) C.push_back(add_and({col[j], col[j - k]}));
    for(int i = k; i < n; i++) {
        vector<int> ask1, ask2;
        for(int l = i; l >= i - k; l--) {
            ask1.push_back(row[l]);
            ask2.push_back(rowx[l]);
        }
        int tmp1 = add_or(ask1);
        int tmp2 = add_not(add_xor(ask2));
        R.push_back(add_and({tmp1, tmp2}));
    }

    if (!R.empty() && !C.empty()) {
        int p1 = add_or(R);
        int p2 = add_or(C);
        lst.push_back(add_and({p1, p2}));
    }

    int res = add_or(lst);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:76:9: warning: unused variable 'res' [-Wunused-variable]
   76 |     int res = add_or(lst);
      |         ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 852 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 852 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 852 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 852 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1236 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 980 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 3488 KB secret mismatch
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 852 KB secret mismatch
2 Halted 0 ms 0 KB -