답안 #431356

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
431356 2021-06-17T11:20:29 Z egekabas Vision Program (IOI19_vision) C++14
44 / 100
13 ms 2192 KB
#include "vision.h"
#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;
int h, w, k;
vector<int> allvals;
void calchor(int nl, int nr, int ml, int mr){
	if(ml == mr) return;
	int nm = (nl+nr)/2;
	int mm = (ml+mr)/2;

	vector<int> vec1, vec2;
	//cout << "vec1\n";
	for(int i = nl; i <= nm; ++i)
		for(int j = ml; j <= mm; ++j){
			vec1.pb(i*w+j);
			//cout << i << ' ' << j << '\n';
		}
	//cout << "vec2\n";
	for(int i = nm+1; i <= nr; ++i)
		for(int j = mm+1; j <= mr; ++j){
			vec2.pb(i*w+j);
			//cout << i << ' ' << j << '\n';
		}
	//cout << '\n';
	if(vec1.size() && vec2.size())
		allvals.pb(add_and({add_or(vec1), add_or(vec2)}));
	calchor(nl, nr, ml, mm);
	calchor(nl, nr, mm+1, mr);
}
void calcvert(int nl, int nr, int ml, int mr){
	if(nl == nr) return;
	calchor(nl, nr, ml, mr);
	int nm = (nl+nr)/2;
	calcvert(nl, nm, ml, mr);
	calcvert(nm+1, nr, ml, mr);
}


void construct_network(int H, int W, int K) {
	h = H;
	w = W;
	k = K;
	allvals.clear();
	calcvert(0, H-1, 0, W-1);

	map<int, vector<int>> diapos;
	map<int, vector<int>> dianeg;
	for(int i = 0; i < H; ++i)
		for(int j = 0; j < W; ++j){
			diapos[i+j].pb(i*W+j);
			dianeg[i-j].pb(i*W+j);
		}
	for(auto & u : diapos)
		u.ss.pb(add_or(u.ss));
	for(auto & u : dianeg)
		u.ss.pb(add_or(u.ss));
	
	vector<int> v1;
	for(auto u : diapos)
		if(u.ss.size() && diapos[u.ff+K].size())
			v1.pb( add_and( {u.ss.back(), diapos[u.ff+K].back()} ) );
	assert(v1.size());
	int samepos = add_or(v1);

	vector<int> v2;
	for(auto u : dianeg)
		if(u.ss.size() && dianeg[u.ff+K].size())
			v2.pb( add_and( {u.ss.back(), dianeg[u.ff+K].back()} ) );
	assert(v2.size());
	int sameneg = add_or(v2);

	if(allvals.empty()){
		add_and({sameneg});
	}
	else{
		int ispos = add_or(allvals);

		add_or({add_and({ispos, samepos}), add_and({add_not(ispos), sameneg})});
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 224 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 224 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 328 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 328 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 224 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 328 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 328 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 5 ms 588 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 3 ms 332 KB Output is correct
33 Correct 3 ms 552 KB Output is correct
34 Correct 4 ms 588 KB Output is correct
35 Correct 4 ms 588 KB Output is correct
36 Correct 4 ms 588 KB Output is correct
37 Correct 3 ms 588 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 224 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 328 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 328 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 5 ms 588 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 3 ms 332 KB Output is correct
33 Correct 3 ms 552 KB Output is correct
34 Correct 4 ms 588 KB Output is correct
35 Correct 4 ms 588 KB Output is correct
36 Correct 4 ms 588 KB Output is correct
37 Correct 3 ms 588 KB Output is correct
38 Incorrect 4 ms 1404 KB WA in grader: Too many instructions
39 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 2 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 2 ms 332 KB Output is correct
11 Correct 2 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 332 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 352 KB Output is correct
18 Correct 1 ms 388 KB Output is correct
19 Correct 2 ms 332 KB Output is correct
20 Correct 2 ms 332 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 13 ms 1364 KB Output is correct
4 Correct 13 ms 1404 KB Output is correct
5 Correct 12 ms 1348 KB Output is correct
6 Correct 12 ms 1376 KB Output is correct
7 Correct 12 ms 1444 KB Output is correct
8 Incorrect 3 ms 1224 KB WA in grader: Too many instructions
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 2192 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 224 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 328 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 328 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 5 ms 588 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 3 ms 332 KB Output is correct
33 Correct 3 ms 552 KB Output is correct
34 Correct 4 ms 588 KB Output is correct
35 Correct 4 ms 588 KB Output is correct
36 Correct 4 ms 588 KB Output is correct
37 Correct 3 ms 588 KB Output is correct
38 Incorrect 4 ms 1404 KB WA in grader: Too many instructions
39 Halted 0 ms 0 KB -