답안 #674472

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
674472 2022-12-24T13:15:43 Z tbzard Vision Program (IOI19_vision) C++14
0 / 100
2 ms 1364 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);
        }
        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 tmp1 = add_or(p2);
        aans.push_back(add_and(vector<int>{aidx[i], tmp1}));
    }
    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);
        }
        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;i++){
            if(i == j) continue;
            if(abs(i-j) <= k){  
                p2.push_back(didx[j]);
            }
        }
        if(p2.empty()) continue;
        p2.push_back(dcheck);
        int tmp1 = add_or(p2);
        dans.push_back(add_and(vector<int>{didx[i], tmp1}));
    }
    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);
    int last2 = check(h, w, k+1);
    int last3 = add_not(last2);
    add_and(vector<int>{last1, last2});
}

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:51: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]
   51 |         for(int j=0;j<dxy[i].size();j++){
      |                     ~^~~~~~~~~~~~~~
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:80:9: warning: unused variable 'last3' [-Wunused-variable]
   80 |     int last3 = add_not(last2);
      |         ^~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 292 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 292 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 292 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 292 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 1 ms 300 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1364 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 292 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -