답안 #815357

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
815357 2023-08-08T14:23:26 Z PagodePaiva Vision Program (IOI19_vision) C++14
컴파일 오류
0 ms 0 KB
    #include "vision.h"
    #include<bits/stdc++.h>
    #define fr first
    #define sc second
     
    using namespace std;
     
    int dist(pair <int,int>a,pair<int,int>b){
    	return abs(a.fr-b.fr)+abs(a.sc-b.sc);
    }
     
    void construct_network(int H, int W, int K) {
    	// std::vector<int> Ns;
    	// Ns = {0, 1};
    	// int a = add_and(Ns);
    	// Ns = {0, a};
    	// int b = add_or(Ns);
    	// Ns = {0, 1, b};
    	// int c = add_xor(Ns);
    	// add_not(c);
     
    	int n = H, m = W, k = K;
    	int r = n*m;
     	vector <int> auxx;
     	vector <int> aux;

    	for(int i = 0;i < n;i++){
    		for(int j = 0;j < m;j++){
    			for(int i1 = 0;i1 < n;i1++){
    				for(int j1 = 0;j1 < m;j1++){
    					if(dist({i, j}, {i1, j1}) == k){
    						// r = add_and({i*m+j, i1*m+j1});
    						auxx.push_back(i1*m+j1);	
    					}
    				}
    			}

    			int a1 = add_xor(auxx);
    			auxx.push_back({i*m+j});
    			int a2 = add_xor(auxx);
    			a2 = add_not(auxx);
    			r = add_and({a1, a2});
    			aux.push_back(r);
    		}
    	}
     
    	add_or(aux);
     
    	return;
    }

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:41:21: error: cannot convert 'std::vector<int>' to 'int'
   41 |        a2 = add_not(auxx);
      |                     ^~~~
      |                     |
      |                     std::vector<int>
In file included from vision.cpp:1:
vision.h:16:17: note:   initializing argument 1 of 'int add_not(int)'
   16 | int add_not(int N);
      |             ~~~~^