제출 #721540

#제출 시각아이디문제언어결과실행 시간메모리
721540nguyentunglamVision Program (IOI19_vision)C++17
26 / 100
11 ms2096 KiB
#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);
}

컴파일 시 표준 에러 (stderr) 메시지

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);
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...