답안 #643787

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
643787 2022-09-23T03:04:29 Z ymm Vision Program (IOI19_vision) C++17
44 / 100
18 ms 11896 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 = 40010;
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 1236 KB Output is correct
2 Correct 1 ms 1236 KB Output is correct
3 Correct 1 ms 1236 KB Output is correct
4 Correct 1 ms 1236 KB Output is correct
5 Correct 1 ms 1236 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 1 ms 1236 KB Output is correct
11 Correct 1 ms 1236 KB Output is correct
12 Correct 1 ms 1236 KB Output is correct
13 Correct 1 ms 1236 KB Output is correct
14 Correct 1 ms 1236 KB Output is correct
15 Correct 1 ms 1236 KB Output is correct
16 Correct 1 ms 1236 KB Output is correct
17 Correct 1 ms 1236 KB Output is correct
18 Correct 1 ms 1236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1236 KB Output is correct
2 Correct 1 ms 1236 KB Output is correct
3 Correct 1 ms 1236 KB Output is correct
4 Correct 1 ms 1236 KB Output is correct
5 Correct 1 ms 1236 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 1 ms 1236 KB Output is correct
11 Correct 1 ms 1236 KB Output is correct
12 Correct 1 ms 1236 KB Output is correct
13 Correct 1 ms 1236 KB Output is correct
14 Correct 1 ms 1236 KB Output is correct
15 Correct 1 ms 1236 KB Output is correct
16 Correct 1 ms 1236 KB Output is correct
17 Correct 1 ms 1236 KB Output is correct
18 Correct 1 ms 1236 KB Output is correct
19 Correct 1 ms 1236 KB Output is correct
20 Correct 1 ms 1236 KB Output is correct
21 Correct 1 ms 1236 KB Output is correct
22 Correct 1 ms 1236 KB Output is correct
23 Correct 1 ms 1236 KB Output is correct
24 Correct 1 ms 1236 KB Output is correct
25 Correct 1 ms 1236 KB Output is correct
26 Correct 1 ms 1236 KB Output is correct
27 Correct 1 ms 1236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1236 KB Output is correct
2 Correct 1 ms 1236 KB Output is correct
3 Correct 1 ms 1236 KB Output is correct
4 Correct 1 ms 1236 KB Output is correct
5 Correct 1 ms 1236 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 1 ms 1236 KB Output is correct
11 Correct 1 ms 1236 KB Output is correct
12 Correct 1 ms 1236 KB Output is correct
13 Correct 1 ms 1236 KB Output is correct
14 Correct 1 ms 1236 KB Output is correct
15 Correct 1 ms 1236 KB Output is correct
16 Correct 1 ms 1236 KB Output is correct
17 Correct 1 ms 1236 KB Output is correct
18 Correct 1 ms 1236 KB Output is correct
19 Correct 1 ms 1236 KB Output is correct
20 Correct 1 ms 1236 KB Output is correct
21 Correct 1 ms 1236 KB Output is correct
22 Correct 1 ms 1236 KB Output is correct
23 Correct 1 ms 1236 KB Output is correct
24 Correct 1 ms 1236 KB Output is correct
25 Correct 1 ms 1236 KB Output is correct
26 Correct 1 ms 1236 KB Output is correct
27 Correct 1 ms 1236 KB Output is correct
28 Correct 5 ms 1748 KB Output is correct
29 Correct 1 ms 1236 KB Output is correct
30 Correct 1 ms 1236 KB Output is correct
31 Correct 1 ms 1236 KB Output is correct
32 Correct 2 ms 1364 KB Output is correct
33 Correct 2 ms 1364 KB Output is correct
34 Correct 5 ms 1748 KB Output is correct
35 Correct 3 ms 1620 KB Output is correct
36 Correct 2 ms 1364 KB Output is correct
37 Correct 2 ms 1364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1236 KB Output is correct
2 Correct 1 ms 1236 KB Output is correct
3 Correct 1 ms 1236 KB Output is correct
4 Correct 1 ms 1236 KB Output is correct
5 Correct 1 ms 1236 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 1 ms 1236 KB Output is correct
11 Correct 1 ms 1236 KB Output is correct
12 Correct 1 ms 1236 KB Output is correct
13 Correct 1 ms 1236 KB Output is correct
14 Correct 1 ms 1236 KB Output is correct
15 Correct 1 ms 1236 KB Output is correct
16 Correct 1 ms 1236 KB Output is correct
17 Correct 1 ms 1236 KB Output is correct
18 Correct 1 ms 1236 KB Output is correct
19 Correct 1 ms 1236 KB Output is correct
20 Correct 1 ms 1236 KB Output is correct
21 Correct 1 ms 1236 KB Output is correct
22 Correct 1 ms 1236 KB Output is correct
23 Correct 1 ms 1236 KB Output is correct
24 Correct 1 ms 1236 KB Output is correct
25 Correct 1 ms 1236 KB Output is correct
26 Correct 1 ms 1236 KB Output is correct
27 Correct 1 ms 1236 KB Output is correct
28 Correct 5 ms 1748 KB Output is correct
29 Correct 1 ms 1236 KB Output is correct
30 Correct 1 ms 1236 KB Output is correct
31 Correct 1 ms 1236 KB Output is correct
32 Correct 2 ms 1364 KB Output is correct
33 Correct 2 ms 1364 KB Output is correct
34 Correct 5 ms 1748 KB Output is correct
35 Correct 3 ms 1620 KB Output is correct
36 Correct 2 ms 1364 KB Output is correct
37 Correct 2 ms 1364 KB Output is correct
38 Incorrect 18 ms 11896 KB WA in grader: Too many inputs
39 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1236 KB Output is correct
2 Correct 1 ms 1236 KB Output is correct
3 Correct 1 ms 1236 KB Output is correct
4 Correct 1 ms 1236 KB Output is correct
5 Correct 1 ms 1236 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 1 ms 1236 KB Output is correct
11 Correct 1 ms 1236 KB Output is correct
12 Correct 1 ms 1236 KB Output is correct
13 Correct 1 ms 1236 KB Output is correct
14 Correct 1 ms 1236 KB Output is correct
15 Correct 1 ms 1236 KB Output is correct
16 Correct 1 ms 1236 KB Output is correct
17 Correct 1 ms 1236 KB Output is correct
18 Correct 1 ms 1236 KB Output is correct
19 Correct 1 ms 1236 KB Output is correct
20 Correct 1 ms 1236 KB Output is correct
21 Correct 1 ms 1236 KB Output is correct
22 Correct 1 ms 1236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1236 KB Output is correct
2 Correct 1 ms 1236 KB Output is correct
3 Correct 4 ms 1876 KB Output is correct
4 Correct 17 ms 3408 KB Output is correct
5 Correct 12 ms 2684 KB Output is correct
6 Correct 6 ms 2000 KB Output is correct
7 Correct 5 ms 1620 KB Output is correct
8 Incorrect 2 ms 2128 KB WA in grader: Too many instructions
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 3280 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1236 KB Output is correct
2 Correct 1 ms 1236 KB Output is correct
3 Correct 1 ms 1236 KB Output is correct
4 Correct 1 ms 1236 KB Output is correct
5 Correct 1 ms 1236 KB Output is correct
6 Correct 1 ms 1236 KB Output is correct
7 Correct 1 ms 1236 KB Output is correct
8 Correct 1 ms 1236 KB Output is correct
9 Correct 1 ms 1236 KB Output is correct
10 Correct 1 ms 1236 KB Output is correct
11 Correct 1 ms 1236 KB Output is correct
12 Correct 1 ms 1236 KB Output is correct
13 Correct 1 ms 1236 KB Output is correct
14 Correct 1 ms 1236 KB Output is correct
15 Correct 1 ms 1236 KB Output is correct
16 Correct 1 ms 1236 KB Output is correct
17 Correct 1 ms 1236 KB Output is correct
18 Correct 1 ms 1236 KB Output is correct
19 Correct 1 ms 1236 KB Output is correct
20 Correct 1 ms 1236 KB Output is correct
21 Correct 1 ms 1236 KB Output is correct
22 Correct 1 ms 1236 KB Output is correct
23 Correct 1 ms 1236 KB Output is correct
24 Correct 1 ms 1236 KB Output is correct
25 Correct 1 ms 1236 KB Output is correct
26 Correct 1 ms 1236 KB Output is correct
27 Correct 1 ms 1236 KB Output is correct
28 Correct 5 ms 1748 KB Output is correct
29 Correct 1 ms 1236 KB Output is correct
30 Correct 1 ms 1236 KB Output is correct
31 Correct 1 ms 1236 KB Output is correct
32 Correct 2 ms 1364 KB Output is correct
33 Correct 2 ms 1364 KB Output is correct
34 Correct 5 ms 1748 KB Output is correct
35 Correct 3 ms 1620 KB Output is correct
36 Correct 2 ms 1364 KB Output is correct
37 Correct 2 ms 1364 KB Output is correct
38 Incorrect 18 ms 11896 KB WA in grader: Too many inputs
39 Halted 0 ms 0 KB -