답안 #210331

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
210331 2020-03-17T05:11:20 Z Segtree Vision Program (IOI19_vision) C++14
12 / 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);
	Ns.push_back(x_k);
	Ns.push_back(y_k);
	add_or(Ns);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:77:6: warning: unused variable 'vl' [-Wunused-variable]
  int vl=add_and(Ns);
      ^~
vision.cpp:81:6: warning: unused variable 'vr' [-Wunused-variable]
  int vr=add_and(Ns);
      ^~
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 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Incorrect 5 ms 256 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Incorrect 5 ms 256 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Incorrect 5 ms 256 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Incorrect 5 ms 256 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 6 ms 380 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 380 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 6 ms 376 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 7 ms 376 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
5 Correct 6 ms 376 KB Output is correct
6 Correct 6 ms 376 KB Output is correct
7 Correct 6 ms 376 KB Output is correct
8 Correct 8 ms 504 KB Output is correct
9 Correct 8 ms 504 KB Output is correct
10 Correct 8 ms 508 KB Output is correct
11 Correct 8 ms 504 KB Output is correct
12 Correct 8 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 376 KB Output is correct
17 Correct 5 ms 376 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 376 KB Output is correct
20 Correct 20 ms 760 KB Output is correct
21 Incorrect 20 ms 760 KB on inputs (0, 0), (199, 99), expected 0, but computed 1
22 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 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Incorrect 5 ms 256 KB on inputs (0, 2), (1, 0), expected 0, but computed 1
8 Halted 0 ms 0 KB -