Submission #977772

#TimeUsernameProblemLanguageResultExecution timeMemory
977772LucaIlieVision Program (IOI19_vision)C++17
100 / 100
28 ms4056 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; const int MAX_N = 200; int d1[2 * MAX_N - 1], d2[2 * MAX_N - 1]; int prefd1[2 * MAX_N - 1], prefd2[2 * MAX_N - 1]; vector<int> diag1[2 * MAX_N - 1], diag2[2 * MAX_N - 1]; int n, m; int cellId( int l, int c ) { if ( l < 0 || c < 0 || l >= n || c >= m ) return -1; return l * m + c; } int solveGreater( int k ) { for ( int i = 0; i < n; i++ ) { for ( int j = 0; j < m; j++ ) { diag1[i + j].push_back( cellId( i, j )); diag2[i - j + m - 1].push_back( cellId( i, j )); } } vector<int> ans; for ( int d = 0; d < n + m - 1; d++ ) { d1[d] = add_or( diag1[d] ); d2[d] = add_or( diag2[d] ); if ( d >= 1 ) { prefd1[d] = add_or( { prefd1[d - 1], d1[d] } ); prefd2[d] = add_or( { prefd2[d - 1], d2[d] } ); } else { prefd1[d] = d1[d]; prefd2[d] = d2[d]; } if ( d >= k ) { ans.push_back( add_and( { d1[d], prefd1[d - k] } ) ); ans.push_back( add_and( { d2[d], prefd2[d - k] } ) ); } } return add_or( ans ); } void construct_network( int N, int M, int K ) { n = N, m = M; int k = K; if ( k == n + m - 2 ) solveGreater( k ); else add_xor( { solveGreater( k ), solveGreater( k + 1 ) } ); }
#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...