이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
int n1 = n, m1 = m;
if ( n * m * 2 > 10000 )
n1 = m1 = 1;
for ( int l = 0; l < n1; l++ ) {
for ( int c = 0; c < m1; c++ ) {
vector<int> cells;
for ( int dl = 0; dl <= k; dl++ ) {
int dc = k - dl;
if ( cellId( l - dl, c - dc ) != -1 )
cells.push_back( cellId( l - dl, c - dc ) );
if ( cellId( l + dl, c - dc ) != -1 )
cells.push_back( cellId( l + dl, c - dc ) );
if ( cellId( l - dl, c + dc ) != -1 )
cells.push_back( cellId( l - dl, c + dc ) );
if ( cellId( l + dl, c + dc ) != -1 )
cells.push_back( cellId( l + dl, c + dc ) );
}
sort( cells.begin(), cells.end() );
cells.resize( unique( cells.begin(), cells.end() ) - cells.begin() );
if ( cells.empty() )
continue;
add_or( cells );
id++;
add_and( { id - 1, cellId( l, c ) } );
ids.push_back( id );
id++;
}
}
add_or( ids );
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |