답안 #643786

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
643786 2022-09-23T03:03:11 Z ymm Vision Program (IOI19_vision) C++17
44 / 100
17 ms 5332 KB
#include "vision.h"
#include <bits/stdc++.h>
#define Loop(x,l,r) for (ll x = (l); x < (r); ++x)
#define LoopR(x,l,r) for (ll x = (r)-1; x >= (l); --x)
typedef long long ll;
typedef std::pair<int, int> pii;
typedef std::pair<ll , ll > pll;
using namespace std;

const int N = 4010;
int h, w, k;
int n;

int get_n(int x, int y) { return 0 <= x && x < h && 0 <= y && y < w? x*w + y: -1;}
vector<int> nbr[N];

void construct_network(int H, int W, int K)
{
	h = H; w = W; k = K;
	n = w*h;
	Loop (i,0,h) Loop (j,0,w) {
		Loop (c,0,k) {
			int x, y;

			x = i+k; y = j;
			x -= c; y += c;
			if (get_n(x, y) >= 0)
				nbr[get_n(i, j)].push_back(get_n(x, y));

			x = i; y = j+k;
			x -= c; y -= c;
			if (get_n(x, y) >= 0)
				nbr[get_n(i, j)].push_back(get_n(x, y));

			x = i-k; y = j;
			x += c; y -= c;
			if (get_n(x, y) >= 0)
				nbr[get_n(i, j)].push_back(get_n(x, y));

			x = i; y = j-k;
			x += c; y += c;
			if (get_n(x, y) >= 0)
				nbr[get_n(i, j)].push_back(get_n(x, y));
		}
	}
	//Loop (i,0,n) {
	//	cout << i << ": ";
	//	for (int x : nbr[i])
	//		cout << x << ' ';
	//	cout << '\n';
	//}
	Loop (i,0,n)
		nbr[i].size()? add_or(nbr[i]): add_not(i);
	Loop (i,0,n)
		add_and({i, n+i});
	vector<int> kooft(n);
	iota(kooft.begin(), kooft.end(), 2*n);
	add_or(kooft);
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:55:12: warning: narrowing conversion of 'i' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
   55 |   add_and({i, n+i});
      |            ^
vision.cpp:55:12: warning: narrowing conversion of 'i' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
vision.cpp:55:16: warning: narrowing conversion of '(((ll)n) + i)' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
   55 |   add_and({i, n+i});
      |               ~^~
vision.cpp:55:16: warning: narrowing conversion of '(((ll)n) + i)' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 392 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 396 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 400 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 396 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 0 ms 392 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 392 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 396 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 400 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 396 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 0 ms 392 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 396 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 392 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 396 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 400 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 396 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 0 ms 392 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 396 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 5 ms 912 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 468 KB Output is correct
32 Correct 1 ms 468 KB Output is correct
33 Correct 2 ms 468 KB Output is correct
34 Correct 4 ms 908 KB Output is correct
35 Correct 3 ms 724 KB Output is correct
36 Correct 2 ms 468 KB Output is correct
37 Correct 2 ms 520 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 392 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 396 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 400 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 396 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 0 ms 392 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 396 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 5 ms 912 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 468 KB Output is correct
32 Correct 1 ms 468 KB Output is correct
33 Correct 2 ms 468 KB Output is correct
34 Correct 4 ms 908 KB Output is correct
35 Correct 3 ms 724 KB Output is correct
36 Correct 2 ms 468 KB Output is correct
37 Correct 2 ms 520 KB Output is correct
38 Runtime error 8 ms 5332 KB Execution killed with signal 11
39 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 396 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 396 KB Output is correct
8 Correct 1 ms 396 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 388 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 396 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 280 KB Output is correct
3 Correct 4 ms 980 KB Output is correct
4 Correct 17 ms 2572 KB Output is correct
5 Correct 15 ms 1796 KB Output is correct
6 Correct 6 ms 1232 KB Output is correct
7 Correct 4 ms 776 KB Output is correct
8 Runtime error 1 ms 852 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 780 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 392 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 1 ms 396 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 400 KB Output is correct
10 Correct 0 ms 340 KB Output is correct
11 Correct 1 ms 396 KB Output is correct
12 Correct 0 ms 340 KB Output is correct
13 Correct 0 ms 340 KB Output is correct
14 Correct 0 ms 392 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 396 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 5 ms 912 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 468 KB Output is correct
32 Correct 1 ms 468 KB Output is correct
33 Correct 2 ms 468 KB Output is correct
34 Correct 4 ms 908 KB Output is correct
35 Correct 3 ms 724 KB Output is correct
36 Correct 2 ms 468 KB Output is correct
37 Correct 2 ms 520 KB Output is correct
38 Runtime error 8 ms 5332 KB Execution killed with signal 11
39 Halted 0 ms 0 KB -