답안 #152212

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
152212 2019-09-06T19:26:17 Z nvmdava Vision Program (IOI19_vision) C++17
컴파일 오류
0 ms 0 KB
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;

int q;
vector<int> s, d;
int h, w, k;

vector<int> find(int c1, int c2, int s){
	vector<int> res;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(i * c1 + j * c2 == s){
				res.push_back(i * w + j);
			}
		}
	}
	return res;
}

int get(vector<int> pref, int k){
	vector<int> ask;
	for(int i = k; i < pref.size(); i++)
		ask.push_back(add_and({pref[i - k], pref[i]}));
	
	return add_or(ask);
}

void construct_network(int H, int W, int K){
    q = H * W - 1;

    h = H;
    w = W;
    k = K;

    for(int i = 0; i < H + W - 1; i++){
    	vector<int> ask = find(1, 1, i);
    	if(s.empty())
    		s.push_back(add_or(ask));
    	else 
    		s.push_back(add_xor(ask, add_or(ask)));
    }
    
    for(int i = 1 - W; i <= H - 1; i++){
    	vector<int> ask; = find(1, -1, i);
    	if(d.empty())
    		d.push_back(add_or(ask));
    	else 
    		d.push_back(add_xor(ask, add_or(ask)));
    }

    int sk = get(s, k - 1);
    int sk1 = get(s, k);
    int dk = get(d, k - 1);
    int dk1 = get(d, k);

    add_and({add_or({sk, dk}), add_not({add_or(sk1, dk1)})});
}

Compilation message

vision.cpp: In function 'int get(std::vector<int>, int)':
vision.cpp:23:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = k; i < pref.size(); i++)
                 ~~^~~~~~~~~~~~~
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:41:43: error: too many arguments to function 'int add_xor(std::vector<int>)'
       s.push_back(add_xor(ask, add_or(ask)));
                                           ^
In file included from vision.cpp:1:0:
vision.h:14:5: note: declared here
 int add_xor(std::vector<int> Ns);
     ^~~~~~~
vision.cpp:45:23: error: expected primary-expression before '=' token
      vector<int> ask; = find(1, -1, i);
                       ^
vision.cpp:49:43: error: too many arguments to function 'int add_xor(std::vector<int>)'
       d.push_back(add_xor(ask, add_or(ask)));
                                           ^
In file included from vision.cpp:1:0:
vision.h:14:5: note: declared here
 int add_xor(std::vector<int> Ns);
     ^~~~~~~
vision.cpp:57:56: error: could not convert 'sk1' from 'int' to 'std::vector<int>'
     add_and({add_or({sk, dk}), add_not({add_or(sk1, dk1)})});
                                                        ^
vision.cpp:57:58: error: cannot convert '<brace-enclosed initializer list>' to 'int' for argument '1' to 'int add_not(int)'
     add_and({add_or({sk, dk}), add_not({add_or(sk1, dk1)})});
                                                          ^
vision.cpp:57:60: error: could not convert '{add_or(std::vector<int>(std::initializer_list<int>{((const int*)(& const int [2]{sk, dk})), 2}, std::allocator<int>())), <expression error>}' from '<brace-enclosed initializer list>' to 'std::vector<int>'
     add_and({add_or({sk, dk}), add_not({add_or(sk1, dk1)})});
                                                            ^