답안 #245363

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
245363 2020-07-06T06:32:30 Z crossing0ver Vision Program (IOI19_vision) C++17
41 / 100
6 ms 512 KB
#include<bits/stdc++.h>
#define vi vector<int>
#define pii pair<int,int>
#define pb push_back
#ifndef local
#include "vision.h"
#endif
using namespace std;
int k,H,W;
int get_id(int i,int j) {
	return i*W+j;
}
void smallCase() {
	vector<pii> s;
	for (int i = 0; i < H; i++)
	for (int j = 0; j < W; j++)
	for (int a = i; a < H; a++)
	for (int b = 0; b < W; b++) {
			if (abs(i-a)+abs(j-b) == k) s.pb({get_id(i,j),get_id(a,b)});
		}
	int a = 0;
	for (auto i : s) {
		vector<int> v = {i.first,i.second};
		a|=add_and(v);
	}
	int x = s.size();
	vi v;
	for (int i = H*W; i < H*W + x;i++)
		v.pb(i);
	if (v.size() == 0) {
		add_not(1);
		return;
	}
	add_or(v);
}
void SMALL() {
	int cnt = 0;
	for (int i = 0;i < H; i++)
	for (int j = 0;j < W; j++) {
		vector<int> s;
	for (int a = 0; a < H; a++)
	for (int b = 0; b < W; b++) {
			if (abs(i-a)+abs(j-b) == k) s.pb(get_id(a,b));
	}
	if (s.size()) {
	add_or(s);
	cnt++;
	}
	else {
		add_not(1);
		cnt++;
	}
	}
	int st = H*W+cnt;
	int en = H*W+cnt;
	for (int i = 0;i < H*W; i++) {
		add_and({i,st});
		en++;
	}
	vi v;
	for (int i = st;i < en;i++)
		v.pb(i);
	add_or(v); 
	
	
}
void construct_network(int H1, int W1, int k1) {
	k = k1;
	H = H1, W = W1;
	vector<pii> s;
	if (max(H,W) <= 10 || min(H,W) == 1) {
		smallCase();
		return;
	}
  if (max(H,W) <= 30) {
    SMALL();
    return;
  }
	vector<int> v;
	int cnt = 0;
	for (int i = 0; i < H;i++)
	for (int j = 0;j < W; j++) 
		if (i + j == k) {
			add_and({0,get_id(i,j)});
			cnt++;
		}
	for (int i = H*W; i < H*W + cnt; i++)
		v.pb(i);
	add_or(v);
	
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 4 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 4 ms 416 KB Output is correct
12 Correct 4 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 4 ms 256 KB Output is correct
17 Correct 4 ms 256 KB Output is correct
18 Correct 4 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 4 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 4 ms 416 KB Output is correct
12 Correct 4 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 4 ms 256 KB Output is correct
17 Correct 4 ms 256 KB Output is correct
18 Correct 4 ms 256 KB Output is correct
19 Correct 4 ms 256 KB Output is correct
20 Correct 4 ms 256 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 4 ms 256 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 4 ms 384 KB Output is correct
27 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 4 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 4 ms 416 KB Output is correct
12 Correct 4 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 4 ms 256 KB Output is correct
17 Correct 4 ms 256 KB Output is correct
18 Correct 4 ms 256 KB Output is correct
19 Correct 4 ms 256 KB Output is correct
20 Correct 4 ms 256 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 4 ms 256 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 4 ms 384 KB Output is correct
27 Correct 5 ms 256 KB Output is correct
28 Incorrect 6 ms 512 KB WA in grader: Invalid index
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 4 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 4 ms 416 KB Output is correct
12 Correct 4 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 4 ms 256 KB Output is correct
17 Correct 4 ms 256 KB Output is correct
18 Correct 4 ms 256 KB Output is correct
19 Correct 4 ms 256 KB Output is correct
20 Correct 4 ms 256 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 4 ms 256 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 4 ms 384 KB Output is correct
27 Correct 5 ms 256 KB Output is correct
28 Incorrect 6 ms 512 KB WA in grader: Invalid index
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 4 ms 256 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 256 KB Output is correct
20 Correct 5 ms 256 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 4 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 4 ms 256 KB Output is correct
6 Correct 4 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 4 ms 256 KB Output is correct
10 Correct 4 ms 256 KB Output is correct
11 Correct 4 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 4 ms 256 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 4 ms 256 KB Output is correct
22 Correct 5 ms 256 KB Output is correct
23 Correct 5 ms 256 KB Output is correct
24 Correct 5 ms 256 KB Output is correct
25 Correct 5 ms 256 KB Output is correct
26 Correct 4 ms 384 KB Output is correct
27 Correct 4 ms 256 KB Output is correct
28 Correct 5 ms 256 KB Output is correct
29 Correct 5 ms 512 KB Output is correct
30 Correct 5 ms 256 KB Output is correct
31 Correct 4 ms 256 KB Output is correct
32 Correct 4 ms 256 KB Output is correct
33 Correct 4 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 5 ms 256 KB on inputs (80, 199), (81, 199), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 256 KB Output is correct
3 Correct 4 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 4 ms 256 KB Output is correct
8 Correct 4 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 4 ms 416 KB Output is correct
12 Correct 4 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 4 ms 256 KB Output is correct
17 Correct 4 ms 256 KB Output is correct
18 Correct 4 ms 256 KB Output is correct
19 Correct 4 ms 256 KB Output is correct
20 Correct 4 ms 256 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 4 ms 256 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 4 ms 384 KB Output is correct
27 Correct 5 ms 256 KB Output is correct
28 Incorrect 6 ms 512 KB WA in grader: Invalid index
29 Halted 0 ms 0 KB -