답안 #145728

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
145728 2019-08-21T00:52:23 Z oscarsierra12 Vision Program (IOI19_vision) C++14
0 / 100
13 ms 4668 KB
#include "vision.h"
#include <bits/stdc++.h>
using namespace std ;

int cnt ;
vector <int> Ns, Ns2 ;
int pos1 = 0, pos2 = 0, var ;

int go () {
    if ( min ( Ns.size(), Ns2.size() ) == 0 ) return 0 ;
    add_or ( Ns ) ;
    add_or ( Ns2 ) ;
    add_and ( vector <int>{cnt, cnt+1} ) ;
    cnt+=3 ;
}

void ini() {
    Ns = vector<int>(), Ns2 = vector<int>() ;
}

int filCol ( int H, int W, int K ) {
    for ( int i = 0 ; i < H ;++i ) {
        ini() ;
        for ( int j = 0 ; j < W ;++j ) Ns2.push_back ( i*W+j );
        for ( int j = 0 ; j < H ;++j ) {
            if ( abs(i-j) > K )
                for ( int k = 0 ; k < W; ++k ) Ns.push_back ( j*W+k ) ;
        }
        go() ;
	}
}

int goDiagonal ( int fil, int col, int flag, int H, int W ) {
    while ( fil >= 0 && col < W ) {
        if ( fil >= H || col < 0 ) {}
        else{if ( flag ) Ns.push_back ( fil*W+col ) ;
        else Ns2.push_back ( fil*W+col ) ;}
        fil-- ;
        col++ ;
    }
}

int otDiag ( int fil, int col, int flag, int H, int W ) {
    while ( fil >= 0 && col >= 0 ) {
        if ( fil >= H || col >= W ) {}
        else{if ( flag ) Ns.push_back ( fil*W+col ) ;
        else Ns2.push_back ( fil*W+col ) ;}
        fil-- ;
        col-- ;
    }
}

int diagDer ( int H, int W, int K ) {
    for ( int i = 0 ; i < H; ++i ) {
        ini() ;
        goDiagonal ( i+K, 0, 1, H, W ) ;
        goDiagonal ( i-K, 0, 1, H, W ) ;
        goDiagonal ( i, 0,0, H, W ) ;
        go() ;
    }
    for ( int i = 0 ; i < W ; ++i ) {
        ini() ;
        goDiagonal ( H-1, i-K, 1, H, W ) ;
        goDiagonal ( H-1, i+K, 1, H, W ) ;
        goDiagonal ( H-1, i, 0, H, W ) ;
        go() ;
    }
}

int diagIzq ( int H, int W, int K ) {
    for ( int i = 0 ; i < H; ++i ) {
        ini() ;
        otDiag ( i+K, W-1, 1, H, W ) ;
        otDiag ( i-K, W-1, 1, H, W ) ;
        otDiag ( i, W-1,0, H, W ) ;
        go() ;
    }
    for ( int i = 0 ; i < W ; ++i ) {
        ini() ;
        otDiag ( H-1, i-K, 1, H, W ) ;
        otDiag ( H-1, i+K, 1, H, W ) ;
        otDiag ( H-1, i, 0, H, W ) ;
        go() ;
    }
}

void solve ( int H, int W, int K, int flag ) {
    filCol ( H, W,K ) ;
    filCol ( W, H,K ) ;
    diagDer ( H, W, K ) ;
    diagIzq ( H, W, K ) ;
    vector <int> frOr ;
    int cur = 0 ;
    for ( int i = var ; i < cnt ; ++i ) {
        if ( cur==2 ) frOr.push_back ( i );
        cur++ ;
        cur%=3 ;
    }
    add_or ( frOr ) ;
    if ( flag ) pos1 = cnt ;
    else pos2 = cnt ;
    cnt++ ;
    var = cnt ;
}

void construct_network(int H, int W, int K) {
    var = cnt = H*W ;
    solve ( H, W, K, 1 ) ;
    solve ( H, W, K-1, 0 ) ;
    add_xor ( vector <int>{pos1,pos2} ) ;
}

Compilation message

vision.cpp: In function 'int filCol(int, int, int)':
vision.cpp:31:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
vision.cpp: In function 'int goDiagonal(int, int, int, int, int)':
vision.cpp:41:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
vision.cpp: In function 'int otDiag(int, int, int, int, int)':
vision.cpp:51:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
vision.cpp: In function 'int diagDer(int, int, int)':
vision.cpp:68:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
vision.cpp: In function 'int diagIzq(int, int, int)':
vision.cpp:85:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
vision.cpp: In function 'int go()':
vision.cpp:15:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 396 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 396 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 396 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 396 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 12 ms 1116 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13 ms 4668 KB WA in grader: Too many inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 396 KB on inputs (0, 0), (0, 1), expected 1, but computed 0
2 Halted 0 ms 0 KB -