답안 #293714

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

int a, b, c, d;

vector< int > ans;

void add_xor(vector< int > v){
	int rep = 0;
	for(auto e : v){
		rep ^= ans[e];
	}
	ans.push_back(rep);
}

void add_and(vector< int > v){
	int rep = 1;
	for(auto e : v){
		rep &= ans[e];
	}
	ans.push_back(rep);
}
void add_or(vector< int > v){
	int rep = 0;
	for(auto e : v){
		rep |= ans[e];
	}
	ans.push_back(rep);
}

void construct_network(int H, int W, int K) {
	
	vector< int > finalCheck;
	
	int curr = H*W;
	
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			vector< int > goodDist;
			
			for(int k = 0; k < H; k++){
				for(int l = 0; l < W; l++){
					if(abs(i-k)+abs(j-l) == K){
						goodDist.push_back(k*W+l);
					}
				}
			}
			if(goodDist.empty()) continue;
			//cout << "GOODDIST" << endl;
			for(int e : goodDist){
				cout << e << ' ';
			}
			cout << endl;
			add_xor(goodDist);
			curr++;
			//cout << "ADD " << i*W+j << ' ' << curr-1 << endl;
			add_and({i*W+j,curr-1});
			finalCheck.push_back(curr);
			curr++;
		}
	}
	
	add_or(finalCheck);
}


/*int main(){
	int h, w, k;
	cin >> h >> w >> k;
	cin >> a >> b>>c >> d;
	bool verif ;
	cin >> verif;
	
	for(int i = 0; i < h; i++){
		for(int j= 0; j < w; j++){
			//cout << "HERE " << i << ' ' << j << endl;
			if((i == a && j == b) || (i == c && j == d)){
				ans.push_back(1);
			}
			else ans.push_back(0);
		}
	}
	/*for(int e : ans) cout << e << ' ';
	cout << endl;
	construct_network(h,w,k);
	for(int e : ans) cout << e << ' ';
	cout << endl;
	
	if(verif && ans.back()== 1) cout << "JUSTE" << endl;
	else cout << "WRONG" << endl;
}*/

Compilation message

vision.cpp:84:2: warning: "/*" within comment [-Wcomment]
   84 |  /*for(int e : ans) cout << e << ' ';
      |   
vision.cpp:9:6: error: ambiguating new declaration of 'void add_xor(std::vector<int>)'
    9 | void add_xor(vector< int > v){
      |      ^~~~~~~
In file included from vision.cpp:1:
vision.h:14:5: note: old declaration 'int add_xor(std::vector<int>)'
   14 | int add_xor(std::vector<int> Ns);
      |     ^~~~~~~
vision.cpp:17:6: error: ambiguating new declaration of 'void add_and(std::vector<int>)'
   17 | void add_and(vector< int > v){
      |      ^~~~~~~
In file included from vision.cpp:1:
vision.h:10:5: note: old declaration 'int add_and(std::vector<int>)'
   10 | int add_and(std::vector<int> Ns);
      |     ^~~~~~~
vision.cpp:24:6: error: ambiguating new declaration of 'void add_or(std::vector<int>)'
   24 | void add_or(vector< int > v){
      |      ^~~~~~
In file included from vision.cpp:1:
vision.h:12:5: note: old declaration 'int add_or(std::vector<int>)'
   12 | int add_or(std::vector<int> Ns);
      |     ^~~~~~