답안 #152213

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
152213 2019-09-06T19:27:33 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({s.back(), 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({d.back(), 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:45:23: error: expected primary-expression before '=' token
      vector<int> ask; = find(1, -1, i);
                       ^