답안 #210330

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
210330 2020-03-17T05:04:14 Z Segtree Vision Program (IOI19_vision) C++14
0 / 100
40 ms 1272 KB
#include "vision.h"
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<cassert>
#include<stack>
#include<fstream>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define chmin(a,b) a=min(a,b)
#define chmax(a,b) a=max(a,b)

void construct_network(int H, int W, int K) {
	vector<int> Ns;
	int T=H+W-1;
	for(int s=0;s<T;s++){
		Ns.clear();
		rep(i,H)rep(j,W)if(i+j==s)Ns.push_back(i*W+j);
		add_or(Ns);
	}
	for(int s=0;s<T;s++){
		Ns.clear();
		rep(i,H)rep(j,W)if(i-j+W-1==s)Ns.push_back(i*W+j);
		add_or(Ns);
	}
	int qid;
	for(int s=0;s+K<T;s++){
		Ns.clear();
		Ns={H*W+s,H*W+s+K};
		qid=add_and(Ns);
	}
	Ns.clear();
	for(int s=H*W+2*T;s<=qid;s++)Ns.push_back(s);
	int x_k=add_or(Ns);//xの距離がちょうどkなら1
	
	for(int s=0;s+K<T;s++){
		Ns.clear();
		Ns={H*W+T+s,H*W+T+s+K};
		qid=add_and(Ns);
	}
	Ns.clear();
	for(int s=x_k+1;s<=qid;s++)Ns.push_back(s);
	int y_k=add_or(Ns);//yの距離がちょうどkなら1
	
	for(int s=0;s+K<T;s++){
		Ns.clear();
		for(int i=0;i<s;i++)Ns.push_back(i+H*W);
		for(int i=s+K+1;s<T;s++)Ns.push_back(i+H*W);
		qid=add_or(Ns);
	}
	Ns.clear();
	for(int i=y_k+1;i<=qid;i++)Ns.push_back(i);
	int x_kinai=add_and(Ns);//xの距離がK以下なら0
	
	for(int s=0;s+K<T;s++){
		Ns.clear();
		for(int i=0;i<s;i++)Ns.push_back(i+T+H*W);
		for(int i=s+K+1;s<T;s++)Ns.push_back(i+T+H*W);
		qid=add_or(Ns);
	}
	Ns.clear();
	for(int i=x_kinai+1;i<=qid;i++)Ns.push_back(i);
	int y_kinai=add_and(Ns);//yの距離がK以下なら0
	
	int x_kinai_rev=add_not(x_kinai);
	int y_kinai_rev=add_not(y_kinai);
	Ns.clear();
	Ns.push_back(x_k);
	Ns.push_back(y_kinai_rev);
	int vl=add_and(Ns);
	Ns.clear();
	Ns.push_back(y_k);
	Ns.push_back(x_kinai_rev);
	int vr=add_and(Ns);
	Ns.clear();
	Ns.push_back(vl);
	Ns.push_back(vr);
	add_or(Ns);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:40:21: warning: 'qid' may be used uninitialized in this function [-Wmaybe-uninitialized]
  for(int s=H*W+2*T;s<=qid;s++)Ns.push_back(s);
                    ~^~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 5 ms 376 KB on inputs (0, 0), (0, 2), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 5 ms 376 KB on inputs (0, 0), (0, 2), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 5 ms 376 KB on inputs (0, 0), (0, 2), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 5 ms 376 KB on inputs (0, 0), (0, 2), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 7 ms 376 KB Output is correct
4 Incorrect 6 ms 436 KB on inputs (0, 0), (0, 198), expected 1, but computed 0
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Incorrect 5 ms 256 KB on inputs (0, 0), (1, 1), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 40 ms 1272 KB on inputs (126, 120), (176, 169), expected 0, but computed 1
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Incorrect 5 ms 376 KB on inputs (0, 0), (0, 2), expected 1, but computed 0
3 Halted 0 ms 0 KB -