답안 #674479

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
674479 2022-12-24T13:41:19 Z tbzard Vision Program (IOI19_vision) C++14
0 / 100
11 ms 2004 KB
#include <bits/stdc++.h>
using namespace std;

int add_not(int n);
int add_and(vector<int> ns);
int add_or(vector<int> ns);
int add_xor(vector<int> ns);
int getpoint(int x, int y, int w){
    return x*w + y;
}
int check(int h, int w, int k){
    vector<int> aans, dans;
    vector<pair<int, int> > axy[402], dxy[402];
    int aidx[402], didx[402];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            axy[i+j].push_back(make_pair(i, j));
            dxy[i-j+200].push_back(make_pair(i, j));
        }
    }
    vector<int> p3;
    for(int i=0;i<h+w;i++){
        vector<int> p2;
        for(int j=0;j<axy[i].size();j++){
            int p = getpoint(axy[i][j].first, axy[i][j].second, w);
            p2.push_back(p);
        }
        if(p2.empty()) continue;
        aidx[i] = add_or(p2);
        p3.push_back(aidx[i]);
    }
    int acheck = add_xor(p3);

    for(int i=0;i<h+w;i++){
        vector<int> p2;
        for(int j=0;j<h+w;j++){
            if(i == j) continue;
            if(abs(i-j) <= k) p2.push_back(aidx[j]);
        }
        if(p2.empty()) continue;
        p2.push_back(acheck);
        int tmp = add_or(p2);
        aans.push_back(add_and(vector<int>{aidx[i], tmp}));
    }
    int ans1 = add_or(aans);

    p3.clear();
    for(int i=0-w+200;i<h-w+200;i++){
        vector<int> p2;
        for(int j=0;j<dxy[i].size();j++){
            int p = getpoint(dxy[i][j].first, dxy[i][j].second, w);
            p2.push_back(p);
        }
        if(p2.empty()) continue;
        didx[i] = add_or(p2);
        p3.push_back(didx[i]);
    }
    int dcheck = add_xor(p3);

    for(int i=0-w+200;i<h-w+200;i++){
        vector<int> p2;
        for(int j=0-w+200;j<h-w+200;j++){
            if(i == j) continue;
            if(abs(i-j) <= k) p2.push_back(didx[j]);
        }
        if(p2.empty()) continue;
        p2.push_back(dcheck);
        int tmp = add_or(p2);
        dans.push_back(add_and(vector<int>{didx[i], tmp}));
    }
    int ans2 = add_or(dans);

    return add_and(vector<int>{ans1, ans2});
}
void construct_network(int h, int w, int k){
    int last1 = check(h, w, k);
    if(k != 1){
        int last2 = check(h, w, k-1);
        int last3 = add_not(last2);
        add_and(vector<int>{last1, last3});
    }
}

Compilation message

vision.cpp: In function 'int check(int, int, int)':
vision.cpp:24:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         for(int j=0;j<axy[i].size();j++){
      |                     ~^~~~~~~~~~~~~~
vision.cpp:50:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   50 |         for(int j=0;j<dxy[i].size();j++){
      |                     ~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB on inputs (0, 0), (1, 0), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 2004 KB on inputs (96, 130), (143, 84), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -