답안 #286778

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
286778 2020-08-30T22:28:52 Z CaroLinda Vision Program (IOI19_vision) C++14
26 / 100
12 ms 1280 KB
#include <bits/stdc++.h>
#include "vision.h"

#define lp(i,a,b) for(int i = a; i < b ; i++)
#define ff first
#define ss second
#define pb push_back
#define ll long long
#define mk make_pair
#define sz(x) (int)(x.size())
#define pii pair<int,int>
#define mkt make_tuple
#define debug printf

using namespace std ;

int N, M ;
vector<int> v1 , v2 , aux ;

int code(int i, int j) { return i * M + j ; }
bool valid(int x, int y) { return 0 <= min(x,y) && x < N && y < M ; }

int test(vector<int> &v , int K )
{

	vector<int> glob ;
	for(int i = 0 ; i+1 < sz(v) ; i++ )
	{
		aux.clear() ;
		for(int j = i+1 ; j <= min(K+i , sz(v)-1) ; j++ ) aux.pb( v[j] ) ;
		int z = add_or(aux) ;
		aux.clear() ;
 		aux.pb( z ) ;
		aux.pb( v[i] ) ;
		glob.pb( add_and(aux) ) ;
	}

	return add_or(glob) ;

}

void construct_network(int H, int W, int K) 
{
	N = H ;
	M = W ;

	for(int i = 0 ; i < H-1 ; i++ )
	{
		int x = i , y = 0 ;
		aux.clear() ;

		while( valid(x,y) )
		{
			aux.pb( code(x,y) ) ;
			x-- ;
			y++ ;
		}

		v1.pb( add_xor(aux) ) ;

		x = i , y = W-1 ;
		aux.clear() ;

		while( valid(x,y) )
		{
			aux.pb( code(x,y) ) ;
			x-- ;
			y-- ;
		}

		v2.pb(add_xor( aux ) ) ;

	}

	for(int j = 0 , jj = W-1 ; j < W ; j++, jj-- )
	{
		int x = H-1 , y = jj ;
		aux.clear() ;

		while(valid(x,y))
		{
			aux.pb( code(x,y) ) ;
			x-- ;
			y-- ;
		}


		v2.pb( add_xor(aux) ) ;

		aux.clear() ;
		x = H-1 , y = j ;

		while(valid(x,y))
		{
			aux.pb(code(x,y) ) ;
			x-- ;
			y++ ;
		}

		v1.pb( add_xor(aux) ) ;

	}

	vector<int> auxaux ;
	auxaux.pb( test(v1 , K ) ) ;
	auxaux.pb( test(v2, K ) ) ;

	int z1 = add_and(auxaux) ;

	if(K == 1) return ;

	auxaux.clear() ;
	auxaux.pb( test(v1, K-1 ) ) ;
	auxaux.pb( test(v2, K-1 ) ) ;

	int z2 = add_and( auxaux ) ;
	z2 = add_not(z2) ;

	aux.clear() ;
	aux.pb( z1 ) ;
	aux.pb(z2) ;

	add_and(aux) ;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Incorrect 1 ms 384 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Incorrect 1 ms 384 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Incorrect 1 ms 384 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Incorrect 1 ms 384 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 8 ms 896 KB Output is correct
3 Correct 8 ms 896 KB Output is correct
4 Correct 10 ms 1152 KB Output is correct
5 Correct 2 ms 512 KB Output is correct
6 Correct 6 ms 768 KB Output is correct
7 Correct 9 ms 1024 KB Output is correct
8 Correct 10 ms 1152 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 5 ms 768 KB Output is correct
11 Correct 8 ms 896 KB Output is correct
12 Correct 8 ms 896 KB Output is correct
13 Correct 10 ms 1024 KB Output is correct
14 Correct 12 ms 1152 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 5 ms 768 KB Output is correct
17 Correct 8 ms 896 KB Output is correct
18 Correct 9 ms 896 KB Output is correct
19 Correct 10 ms 1024 KB Output is correct
20 Correct 10 ms 1152 KB Output is correct
21 Correct 0 ms 256 KB Output is correct
22 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Incorrect 1 ms 256 KB on inputs (0, 0), (1, 1), expected 1, but computed 0
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 11 ms 1280 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 2 ms 512 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 6 ms 768 KB Output is correct
8 Correct 6 ms 768 KB Output is correct
9 Correct 11 ms 1280 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 0 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 256 KB Output is correct
2 Correct 0 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 256 KB Output is correct
6 Incorrect 1 ms 384 KB on inputs (0, 1), (1, 0), expected 1, but computed 0
7 Halted 0 ms 0 KB -