답안 #764144

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
764144 2023-06-23T07:46:51 Z alexander707070 Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "vision.h"
#define MAXN 507
using namespace std;
 
int n,m,k,dist;
vector<int> d[MAXN],e[MAXN];
int res[MAXN],ser[MAXN],suff[MAXN],suff2[MAXN]; 
vector<int> bad,good;

void construct_network(int H, int W, int K){
    n=H; m=W; k=K;
 
    for(int i=0;i<n;i++){
        for(int f=0;f<m;f++){
            d[i-f+m-1].push_back(i*m+f);
            e[i+f].push_back(i*m+f);
        }
    }
    
    for(int i=0;i<n+m-1;i++){
        res[i]=add_or(d[i]);
        ser[i]=add_or(e[i]);
    }
    
    for(int i=n+m-2;i>=0;i--){
        if(i==n+m-2)suff[i]=res[i];
        else suff[i]=add_or(suff[i+1],res[i]);
        
        if(i==n+m-2)suff2[i]=ser[i];
        else suff2[i]=add_or(suff2[i+1],ser[i]);
    }
    
    for(int i=0;i+k+1<n+m-1;i++){
        bad.push_back({res[i],suff[i+k+1]});
        bad.push_back({ser[i],suff2[i+k+1]});
    }
    
    for(int i=0;i+k<n+m-1;i++){
        good.push_back(add_and({res[i],res[i+k]}));
        good.push_back(add_and({ser[i],ser[i+k]}));
    }
    
    if(bad.empty()){
        add_or(good);
    }else{
        add_and({add_or(good) , add_not(add_or(bad)) });
    }
}
 
/*
int main(){
 
    cout<<count_rectangles({{4, 8, 7, 5, 6},
{7, 4, 10, 3, 5},
{9, 7, 20, 14, 2},
{9, 14, 7, 3, 6},
{5, 7, 5, 2, 7},
{4, 5, 13, 5, 6}})<<"\n";
 
 K=3
 X . . O . .
 . O . . O .
 . . O . . X
 . . . O . .
 
 
 
    return 0;
}
*/

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:28:37: error: could not convert 'suff[(i + 1)]' from 'int' to 'std::vector<int>'
   28 |         else suff[i]=add_or(suff[i+1],res[i]);
      |                             ~~~~~~~~^
      |                                     |
      |                                     int
vision.cpp:31:39: error: could not convert 'suff2[(i + 1)]' from 'int' to 'std::vector<int>'
   31 |         else suff2[i]=add_or(suff2[i+1],ser[i]);
      |                              ~~~~~~~~~^
      |                                       |
      |                                       int
vision.cpp:35:43: error: no matching function for call to 'std::vector<int>::push_back(<brace-enclosed initializer list>)'
   35 |         bad.push_back({res[i],suff[i+k+1]});
      |                                           ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from vision.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
vision.cpp:36:44: error: no matching function for call to 'std::vector<int>::push_back(<brace-enclosed initializer list>)'
   36 |         bad.push_back({ser[i],suff2[i+k+1]});
      |                                            ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:86,
                 from vision.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~