답안 #982314

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
982314 2024-05-14T06:31:56 Z irmuun Vision Program (IOI19_vision) C++17
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
#include "vision.h"

using namespace std;

#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()

void construct_network(int H,int W,int K){
    vector<array<int,3>>C;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            C.pb({i,j,i*W+j});
        }
    }
    int cur=H*W;
    vector<int>Ns;
    for(int i=0;i<C.size();i++){
        vector<int>ask;
        for(int j=0;j<C.size();j++){
            if(abs(C[i][0]-C[j][0])+abs(C[i][1]-C[j][1])==K){
                ask.pb(C[j][2]);
            }
        }
        if(!ask.empty()){
            add_or(ask);
            Ns.pb(add_and({cur,C[i]}));
            cur+=2;
        }
    }
    add_or(Ns);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:22:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(int i=0;i<C.size();i++){
      |                 ~^~~~~~~~~
vision.cpp:24:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::array<int, 3> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |         for(int j=0;j<C.size();j++){
      |                     ~^~~~~~~~~
vision.cpp:31:37: error: could not convert '{cur, C.std::vector<std::array<int, 3> >::operator[](((std::vector<std::array<int, 3> >::size_type)i))}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
   31 |             Ns.pb(add_and({cur,C[i]}));
      |                                     ^
      |                                     |
      |                                     <brace-enclosed initializer list>