답안 #991182

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
991182 2024-06-01T14:10:12 Z PagodePaiva Vision Program (IOI19_vision) C++17
0 / 100
27 ms 3480 KB
#include "vision.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 410;
map <int, int> d1, d2;
map <int, vector <int>> dig1, dig2;

void construct_network(int h, int w, int k) {
	d1.clear();
	d2.clear();
	dig1.clear();
	dig2.clear();
	for(int i = 0;i < h;i++){
		for(int j = 0;j < w;j++){
			dig1[i+j].push_back(i*w+j);
			dig2[i-j].push_back(i*w+j);
		}
	}
	for(int i = 0;i < N;i++){
		if(dig1.find(i) == dig1.end()) continue;
		if(dig1[i].empty()) continue;
		d1[i] = add_or(dig1[i]);
	}
	for(int i = -N+1;i < N;i++){
		if(dig2.find(i) == dig2.end()) continue;
		if(dig2.empty()) continue;
		d2[i] = add_or(dig2[i]);
	}
	// cout << d1.size() << ' ' << d2.size() << '\n';
	int ver1;
	vector <int> digk;
	for(auto [x, v] : d1){
		if(d1.find(x+k) == d1.end()) continue;
		digk.push_back(add_and({v, d1[x+k]}));
	}
	for(auto [x, v] : d2){
		if(d2.find(x+k) == d2.end()) continue;
		digk.push_back(add_and({v, d2[x+k]}));
	}
	// cout << digk.size() << ' ';
	ver1 = add_or(digk);
	int ver2;
	digk.clear();
	for(auto [x, v] : d1){
		vector <int> suf;
		for(int t = k+1;t < N;t++){
			if(d1.find(x+t) == d1.end()) continue;
			suf.push_back(d1[x+t]);
		}
		if(suf.empty()) continue;
		digk.push_back(add_and({v, add_or(suf)}));
	}
	for(auto [x, v] : d2){
		vector <int> suf;
		for(int t = k+1;t < N;t++){
			if(d2.find(x+t) == d2.end()) continue;
			suf.push_back(d2[x+t]);
		}
		if(suf.empty()) continue;
		digk.push_back(add_and({v, add_or(suf)}));
	}
	ver2 = (digk.empty() ? (h*w == 2 ? add_not(0) : add_not(add_and({0, 1, 2}))) : add_not(add_or(digk)));
	int res = add_and({ver1, ver2});
	return;
}

Compilation message

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:65:6: warning: unused variable 'res' [-Wunused-variable]
   65 |  int res = add_and({ver1, ver2});
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
18 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 860 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 5 ms 936 KB Output is correct
6 Correct 3 ms 668 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 5 ms 944 KB Output is correct
10 Correct 4 ms 604 KB Output is correct
11 Correct 3 ms 604 KB Output is correct
12 Correct 3 ms 600 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 5 ms 900 KB Output is correct
16 Correct 4 ms 604 KB Output is correct
17 Correct 3 ms 604 KB Output is correct
18 Correct 3 ms 432 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 3 ms 600 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 2 ms 436 KB Output is correct
6 Correct 2 ms 432 KB Output is correct
7 Correct 2 ms 436 KB Output is correct
8 Correct 10 ms 860 KB Output is correct
9 Correct 4 ms 860 KB Output is correct
10 Correct 4 ms 604 KB Output is correct
11 Correct 3 ms 516 KB Output is correct
12 Correct 2 ms 440 KB Output is correct
13 Correct 5 ms 856 KB Output is correct
14 Correct 4 ms 604 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 5 ms 860 KB Output is correct
18 Correct 3 ms 604 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 13 ms 2100 KB Output is correct
21 Correct 10 ms 1628 KB Output is correct
22 Correct 7 ms 1116 KB Output is correct
23 Correct 5 ms 1004 KB Output is correct
24 Correct 18 ms 2140 KB Output is correct
25 Correct 8 ms 1368 KB Output is correct
26 Correct 5 ms 1112 KB Output is correct
27 Correct 27 ms 3420 KB Output is correct
28 Correct 18 ms 2648 KB Output is correct
29 Correct 13 ms 2136 KB Output is correct
30 Correct 11 ms 1884 KB Output is correct
31 Correct 9 ms 1880 KB Output is correct
32 Incorrect 0 ms 344 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
33 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 3480 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Correct 5 ms 856 KB Output is correct
5 Correct 5 ms 860 KB Output is correct
6 Correct 10 ms 860 KB Output is correct
7 Correct 13 ms 2140 KB Output is correct
8 Correct 17 ms 2396 KB Output is correct
9 Correct 24 ms 3416 KB Output is correct
10 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
18 Halted 0 ms 0 KB -