답안 #991180

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
991180 2024-06-01T13:59:56 Z PagodePaiva Vision Program (IOI19_vision) C++17
0 / 100
23 ms 3420 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) {
	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_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:61:6: warning: unused variable 'res' [-Wunused-variable]
   61 |  int res = add_and({ver1, ver2});
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 2), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 2), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 2), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 2), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 948 KB Output is correct
2 Correct 3 ms 600 KB Output is correct
3 Correct 3 ms 604 KB Output is correct
4 Incorrect 2 ms 344 KB on inputs (0, 0), (0, 198), expected 1, but computed 0
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 1 ms 344 KB on inputs (0, 0), (1, 1), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 3416 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 4 ms 604 KB Output is correct
4 Correct 5 ms 856 KB Output is correct
5 Correct 5 ms 856 KB Output is correct
6 Correct 6 ms 944 KB Output is correct
7 Correct 13 ms 2136 KB Output is correct
8 Correct 14 ms 2392 KB Output is correct
9 Correct 23 ms 3420 KB Output is correct
10 Incorrect 1 ms 348 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
11 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB on inputs (0, 0), (0, 2), expected 1, but computed 0
3 Halted 0 ms 0 KB -