답안 #865699

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
865699 2023-10-24T14:15:50 Z Lib Vision Program (IOI19_vision) C++14
0 / 100
8 ms 1212 KB
#include <bits/stdc++.h>
#include "vision.h"
using namespace std;
vector <int> RowHasBlack;
vector <int> ColumnHasBlack;
vector <int> temp;
int OutputAns_BothRowColumnDifferent(int K, int x, int y){
		//return ( ((RowHasBlack[1]-RowHasBlack[0])  + (ColumnHasBlack[1]-ColumnHasBlack[0]) == K) );
		int res=((RowHasBlack[1]-RowHasBlack[0])  + (ColumnHasBlack[1]-ColumnHasBlack[0]) == K);
		if(res==1){
			res=x;
		}else{
			res=y;
		}
		return add_and({res,x});
		//return RowHasBlack[1];
}
int OutputCert(int K){
	return add_and({0,0});
}
void construct_network(int H, int W, int K){
	RowHasBlack.clear();
	ColumnHasBlack.clear();
	int x,y;
	for(int i=0;i<H;i++){
		temp.clear();
		for(int k=0;k<W;k++){
			temp.push_back(i*W+k);
		}
		if(add_or(temp)){
			RowHasBlack.push_back(i);
			x=H*W+i;
		}else{
			y=W*i;
		}
	}
	for(int i=0;i<W;i++){
		temp.clear();
		for(int k=0;k<H;k++){
			temp.push_back(k*W+i);
		}
		if(add_or(temp)){
			ColumnHasBlack.push_back(i);
		}else{
			y=i;
		}
	}
	if(H*W==2){
		OutputCert(K);
	}else if(RowHasBlack.size()==2&&ColumnHasBlack.size()==2){
		OutputAns_BothRowColumnDifferent(K,x,y);
	}else{
		if(RowHasBlack.size()==1){
			RowHasBlack.push_back(RowHasBlack[0]);
		}else{
			ColumnHasBlack.push_back(ColumnHasBlack[0]);
		}
		OutputAns_BothRowColumnDifferent(K,x,y);
	}
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:58:35: warning: 'y' may be used uninitialized in this function [-Wmaybe-uninitialized]
   58 |   OutputAns_BothRowColumnDifferent(K,x,y);
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
vision.cpp:58:35: warning: 'x' may be used uninitialized in this function [-Wmaybe-uninitialized]
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 600 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 600 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 600 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 600 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB WA in grader: Invalid index
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 1212 KB on inputs (80, 199), (81, 199), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 600 KB on inputs (0, 0), (0, 2), expected 0, but computed 1
2 Halted 0 ms 0 KB -