답안 #721540

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
721540 2023-04-11T03:58:20 Z nguyentunglam Vision Program (IOI19_vision) C++17
26 / 100
11 ms 2096 KB
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;
const int N = 400 + 10;
int a[N][N], row[N], col[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);
    }

    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);
    }

    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> ask;
        for(int l = j; l >= j - k; l--) ask.push_back(col[l]);
        int tmp1 = add_or(ask);
        int tmp2 = add_not(add_xor(ask));
        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> ask;
        for(int l = i; l >= i - k; l--) ask.push_back(row[l]);
        int tmp1 = add_or(ask);
        int tmp2 = add_not(add_xor(ask));
        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:68:9: warning: unused variable 'res' [-Wunused-variable]
   68 |     int res = add_or(lst);
      |         ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 852 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 1 ms 948 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Incorrect 1 ms 948 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 852 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 1 ms 948 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Incorrect 1 ms 948 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 852 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 1 ms 948 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Incorrect 1 ms 948 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 852 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 1 ms 948 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Incorrect 1 ms 948 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1108 KB Output is correct
2 Correct 5 ms 1364 KB Output is correct
3 Correct 5 ms 1364 KB Output is correct
4 Correct 2 ms 980 KB Output is correct
5 Correct 3 ms 1108 KB Output is correct
6 Correct 5 ms 1324 KB Output is correct
7 Correct 5 ms 1236 KB Output is correct
8 Correct 1 ms 980 KB Output is correct
9 Correct 2 ms 1108 KB Output is correct
10 Correct 4 ms 1236 KB Output is correct
11 Correct 5 ms 1364 KB Output is correct
12 Correct 5 ms 1364 KB Output is correct
13 Correct 4 ms 1200 KB Output is correct
14 Correct 1 ms 980 KB Output is correct
15 Correct 2 ms 1108 KB Output is correct
16 Correct 5 ms 1236 KB Output is correct
17 Correct 5 ms 1364 KB Output is correct
18 Correct 6 ms 1328 KB Output is correct
19 Correct 4 ms 1236 KB Output is correct
20 Correct 1 ms 980 KB Output is correct
21 Correct 1 ms 852 KB Output is correct
22 Correct 1 ms 852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 948 KB Output is correct
2 Incorrect 1 ms 948 KB on inputs (0, 0), (1, 1), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 2096 KB Output is correct
2 Correct 1 ms 852 KB Output is correct
3 Correct 2 ms 1108 KB Output is correct
4 Correct 4 ms 1280 KB Output is correct
5 Correct 2 ms 1108 KB Output is correct
6 Correct 2 ms 1108 KB Output is correct
7 Correct 7 ms 1620 KB Output is correct
8 Correct 7 ms 1588 KB Output is correct
9 Correct 11 ms 2096 KB Output is correct
10 Correct 1 ms 852 KB Output is correct
11 Correct 1 ms 852 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 852 KB Output is correct
2 Correct 1 ms 852 KB Output is correct
3 Correct 1 ms 852 KB Output is correct
4 Correct 1 ms 948 KB Output is correct
5 Correct 1 ms 852 KB Output is correct
6 Incorrect 1 ms 948 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -