답안 #291775

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
291775 2020-09-05T18:50:00 Z medmdg Vision Program (IOI19_vision) C++14
0 / 100
19 ms 2048 KB
#include<bits/stdc++.h>
#include "vision.h"
using namespace std;
vector<int> DT(int H,int W,int i,int K){
    vector<int> ans;
    for(int j=0;j<H*W;j++){
        if(abs(j%W-i%W)+abs(j/W-i/W)==K){
            ans.push_back(j);
        }
    }
    return ans;
}
void construct_network(int H, int W, int K){
    int l;
    for(int i=0;i<H;i++){
        vector<int> ans;
        for(int j=0;j<W;j++){
            ans.push_back(j+i*W);
        }
        l=add_or(ans);
    }
    vector<int> cas;
    vector<int> an;
    for(int j=H*W;j<=l;j++){
        an.push_back(j);
    }
    cas.push_back(add_xor(an));
    int be=l+1;
    int en=l+1;
    for(int i=1;i<=K;i++){
        vector<int> ans;
        vector<int> no;
        for(int j=H*W;j<=l-i;j++){
            ans.push_back(j);
            ans.push_back(j+i);
            en=add_and(ans);
            no.push_back(en);
        }
        if(no.size()){
        cas.push_back(add_or(no));
        en++;
        }
    }
    int ll;
    for(int i=0;i<W;i++){
        vector<int> ans;
        for(int j=i;j<H*W;j+=W){
            ans.push_back(j);
        }
        ll=add_or(ans);
    }
    vector<int> cass;
    vector<int> ann;
    for(int j=en+1;j<=ll;j++){
        an.push_back(j);
    }
    cass.push_back(add_xor(an));
    int enn=ll+1;
    for(int i=1;i<=K;i++){
        vector<int> ans;
        vector<int> no;
        for(int j=en;j<=ll-i;j++){
            ans.push_back(j);
            ans.push_back(j+i);
            enn=add_and(ans);
            no.push_back(en);
        }
        if(no.size()){
        cass.push_back(add_or(no));
        en++;
        }
    }
    vector<int> tr;
    tr.push_back(cas[K]);
    tr.push_back(cass[0]);
    en=add_and(tr);
    for(int i=0;i<=K;i++){
        vector<int> trr;
        if(cass.size()>i&&cas.size()>K-i){
            trr.push_back(cas[i]);
            trr.push_back(cas[K-i]);
            enn=add_and(trr);
        }
    }
    vector<int> lk;
    for(int i=en+1;i<=enn;i++){
        lk.push_back(i);
    }
    en=add_or(lk);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:79:23: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   79 |         if(cass.size()>i&&cas.size()>K-i){
      |            ~~~~~~~~~~~^~
vision.cpp:79:37: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   79 |         if(cass.size()>i&&cas.size()>K-i){
      |                           ~~~~~~~~~~^~~~
vision.cpp:28:9: warning: unused variable 'be' [-Wunused-variable]
   28 |     int be=l+1;
      |         ^~
vision.cpp:54:21: warning: 'll' may be used uninitialized in this function [-Wmaybe-uninitialized]
   54 |     for(int j=en+1;j<=ll;j++){
      |                    ~^~~~
vision.cpp:24:20: warning: 'l' may be used uninitialized in this function [-Wmaybe-uninitialized]
   24 |     for(int j=H*W;j<=l;j++){
      |                   ~^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 768 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 256 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 19 ms 2048 KB on inputs (80, 199), (81, 199), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -