Submission #977147

#TimeUsernameProblemLanguageResultExecution timeMemory
977147LucaIlieVision Program (IOI19_vision)C++17
46 / 100
14 ms1884 KiB
#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 xorLineId[MAX_N], xorColumnId[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 l = 0; l < n; l++ ) { vector<int> ids; for ( int c = 0; c < m; c++ ) ids.push_back( cellId( l, c ) ); add_xor( ids ); xorLineId[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 c = 0; c < m; c++ ) { vector<int> ids; for ( int l = 0; l < n; l++ ) ids.push_back( cellId( l, c ) ); add_xor( ids ); xorColumnId[c] = id; id++; } for ( int difL = 0; difL < n && difL <= k; difL++ ) { vector<int> ids; for ( int l = 0; l + difL < n; l++ ) { if ( difL == 0 ) add_xor( { isOnLineId[l], xorLineId[l] } ); else add_and( { isOnLineId[l], isOnLineId[l + difL] } ); ids.push_back( id ); id++; } add_or( ids ); isDifLineId[difL] = id; id++; } for ( int difC = 0; difC < m && difC <= k; difC++ ) { vector<int> ids; for ( int c = 0; c + difC < m; c++ ) { if ( difC == 0 ) add_xor( { isOnColumnId[c], xorColumnId[c] } ); else 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 ); }
#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...