답안 #152214

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
152214 2019-09-06T19:27:51 Z nvmdava Vision Program (IOI19_vision) C++17
26 / 100
30 ms 1404 KB
#include "vision.h"
#include<bits/stdc++.h>
using namespace std;

int q;
vector<int> s, d;
int h, w, k;

vector<int> find(int c1, int c2, int s){
	vector<int> res;
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			if(i * c1 + j * c2 == s){
				res.push_back(i * w + j);
			}
		}
	}
	return res;
}

int get(vector<int> pref, int k){
	vector<int> ask;
	for(int i = k; i < pref.size(); i++)
		ask.push_back(add_and({pref[i - k], pref[i]}));
	
	return add_or(ask);
}

void construct_network(int H, int W, int K){
    q = H * W - 1;

    h = H;
    w = W;
    k = K;

    for(int i = 0; i < H + W - 1; i++){
    	vector<int> ask = find(1, 1, i);
    	if(s.empty())
    		s.push_back(add_or(ask));
    	else 
    		s.push_back(add_xor({s.back(), add_or(ask)}));
    }
    
    for(int i = 1 - W; i <= H - 1; i++){
    	vector<int> ask = find(1, -1, i);
    	if(d.empty())
    		d.push_back(add_or(ask));
    	else 
    		d.push_back(add_xor({d.back(), add_or(ask)}));
    }

    int sk = get(s, k - 1);
    int sk1 = get(s, k);
    int dk = get(d, k - 1);
    int dk1 = get(d, k);

    add_and({add_or({sk, dk}), add_not(add_or({sk1, dk1}))});
}

Compilation message

vision.cpp: In function 'int get(std::vector<int>, int)':
vision.cpp:23:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i = k; i < pref.size(); i++)
                 ~~^~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Incorrect 2 ms 376 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Incorrect 2 ms 376 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Incorrect 2 ms 376 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Incorrect 2 ms 376 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 492 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 376 KB Output is correct
10 Correct 3 ms 504 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 3 ms 376 KB Output is correct
13 Correct 3 ms 380 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 3 ms 504 KB Output is correct
16 Correct 3 ms 504 KB Output is correct
17 Correct 3 ms 504 KB Output is correct
18 Correct 3 ms 376 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 3 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 4 ms 524 KB Output is correct
4 Correct 4 ms 376 KB Output is correct
5 Correct 4 ms 504 KB Output is correct
6 Correct 4 ms 504 KB Output is correct
7 Correct 3 ms 376 KB Output is correct
8 Correct 6 ms 508 KB Output is correct
9 Correct 5 ms 504 KB Output is correct
10 Correct 5 ms 504 KB Output is correct
11 Correct 5 ms 504 KB Output is correct
12 Correct 5 ms 504 KB Output is correct
13 Correct 3 ms 376 KB Output is correct
14 Correct 3 ms 376 KB Output is correct
15 Correct 3 ms 504 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 3 ms 504 KB Output is correct
18 Correct 3 ms 396 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 15 ms 888 KB Output is correct
21 Correct 15 ms 888 KB Output is correct
22 Correct 14 ms 760 KB Output is correct
23 Correct 14 ms 760 KB Output is correct
24 Correct 15 ms 888 KB Output is correct
25 Correct 14 ms 760 KB Output is correct
26 Correct 14 ms 760 KB Output is correct
27 Correct 30 ms 1404 KB Output is correct
28 Incorrect 30 ms 1400 KB on inputs (0, 0), (50, 50), expected 1, but computed 0
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 1400 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 4 ms 504 KB Output is correct
4 Correct 6 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
6 Correct 3 ms 504 KB Output is correct
7 Correct 15 ms 888 KB Output is correct
8 Correct 15 ms 1016 KB Output is correct
9 Correct 30 ms 1400 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 256 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Incorrect 2 ms 376 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
9 Halted 0 ms 0 KB -