답안 #977151

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
977151 2024-05-07T12:29:44 Z LucaIlie Vision Program (IOI19_vision) C++17
0 / 100
3 ms 1496 KB
#include "vision.h"
#include <bits/stdc++.h>

using namespace std;

const int MAX_N = 200;
int isOnLineId[MAX_N], isOnColumnId[MAX_N];
int isDifLineId[MAX_N], isDifColumnId[MAX_N];

int n, m, k;

int cellId( int l, int c ) {
    if ( l < 0 || c < 0 || l >= n || c >= m )
        return -1;
    return l * m + c;
}

void construct_network( int N, int M, int K ) {
    n = N, m = M, k = K;

    int id = n * m;
    for ( int l = 0; l < n; l++ ) {
        vector<int> ids;
        for ( int c = 0; c < m; c++ )
            ids.push_back( cellId( l, c ) );
        add_or( ids );
        isOnLineId[l] = id;
        id++;
    }
    for ( int c = 0; c < m; c++ ) {
        vector<int> ids;
        for ( int l = 0; l < n; l++ )
            ids.push_back( cellId( l, c ) );
        add_or( ids );
        isOnColumnId[c] = id;
        id++;
    }

    for ( int difL = 1; difL < n; difL++ ) {
        vector<int> ids;
        for ( int l = 0; l + difL < n; l++ ) {
            add_and( { isOnLineId[l], isOnLineId[l + difL] } );
            ids.push_back( id );
            id++;
        }
        add_or( ids );
        isDifLineId[difL] = id;
        id++;
    }
    for ( int difC = 1; difC < m; difC++ ) {
        vector<int> ids;
        for ( int c = 0; c + difC < m; c++ ) {
            add_and( { isOnColumnId[c], isOnColumnId[c + difC] } );
            ids.push_back( id );
            id++;
        }
        add_or( ids );
        isDifColumnId[difC] = id;
        id++;
    }

    vector<int> ids;
    for ( int i = 0; i <= k; i++ ) {
        if ( isDifLineId[i] == 0 || isDifColumnId[k - i] == 0 )
            continue;
        add_and( { isDifLineId[i], isDifColumnId[k - i] } );
        ids.push_back( id );
        id++;
    }

    add_or( ids );
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 1240 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1496 KB WA in grader: Too many instructions
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB WA in grader: Instruction with no inputs
2 Halted 0 ms 0 KB -