Submission #976918

#TimeUsernameProblemLanguageResultExecution timeMemory
976918LucaIlieVision Program (IOI19_vision)C++17
33 / 100
2 ms1240 KiB
#include "vision.h"
#include <bits/stdc++.h>

using namespace std;

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;
    vector<int> ids;
    for ( int l = 0; l < n; l++ ) {
        for ( int c = 0; c < m; c++ ) {
            for ( int dl = 0; dl <= k; dl++ ) {
                int dc = k - dl;
                if ( cellId( l - dl, c + dc ) != -1 ) {
                    add_and( { cellId( l, c ), cellId( l - dl, c + dc ) } );
                    ids.push_back( id );
                    id++;
                }
                if ( cellId( l - dl, c - dc ) != -1 ) {
                    add_and( { cellId( l, c ), cellId( l - dl, c - dc ) } );
                    ids.push_back( id );
                    id++;
                }
            }
        }
    }
    add_or( ids );
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...