Submission #198801

#TimeUsernameProblemLanguageResultExecution timeMemory
198801AkashiVision Program (IOI19_vision)C++14
100 / 100
98 ms7472 KiB
#include <bits/stdc++.h> #include "vision.h" using namespace std; struct diags{ int a, b, c; }; int nr_right, nr_left; diags right_diag[405], left_diag[405]; int check(int n, int m, int k){ vector <int> v, v2; vector <int> pos; int left, right; ///right diags for(int i = 1; i + k - 1 <= nr_right ; ++i){ v.clear(); v2.clear(); for(int j = i; j <= i + k - 1 ; ++j){ v.push_back(right_diag[j].a); pos.push_back(right_diag[j].c); } int x = add_or(v); int y = add_xor(v); v.clear(); v.push_back(x); v.push_back(add_not(y)); pos.push_back(add_and(v)); } right = add_or(pos); pos.clear(); ///left diags for(int i = 1; i + k - 1 <= nr_left ; ++i){ v.clear(); v2.clear(); for(int j = i; j <= i + k - 1 ; ++j){ v.push_back(left_diag[j].a); pos.push_back(left_diag[j].c); } int x = add_or(v); int y = add_xor(v); v.clear(); v.push_back(x); v.push_back(add_not(y)); pos.push_back(add_and(v)); } left = add_or(pos); v.clear(); v.push_back(left); v.push_back(right); return add_and(v); } void construct_network(int n, int m, int k) { vector <int> v; int i, j; ///right diags for(i = n - 1; i > 0 ; --i){ int l = i, c = 0; v.clear(); while(l < n && c < m){ v.push_back(l * m + c); ++l; ++c; } right_diag[++nr_right].a = add_or(v); right_diag[nr_right].b = add_xor(v); } for(j = 0; j < m ; ++j){ int l = 0, c = j; v.clear(); while(l < n && c < m){ v.push_back(l * m + c); ++l; ++c; } right_diag[++nr_right].a = add_or(v); right_diag[nr_right].b = add_xor(v); } for(int i = 1; i <= nr_right ; ++i){ v.clear(); v.push_back(right_diag[i].a); v.push_back(add_not(right_diag[i].b)); right_diag[i].c = add_and(v); } ///left diags for(i = n - 1; i > 0 ; --i){ int l = i, c = m - 1; v.clear(); while(l < n && c >= 0){ v.push_back(l * m + c); ++l; --c; } left_diag[++nr_left].a = add_or(v); left_diag[nr_left].b = add_xor(v); } for(j = m - 1; j >= 0 ; --j){ int l = 0, c = j; v.clear(); while(l < n && c >= 0){ v.push_back(l * m + c); ++l; --c; } left_diag[++nr_left].a = add_or(v); left_diag[nr_left].b = add_xor(v); } for(int i = 1; i <= nr_left ; ++i){ v.clear(); v.push_back(left_diag[i].a); v.push_back(add_not(left_diag[i].b)); left_diag[i].c = add_and(v); } int ans1 = check(n, m, k + 1); int ans2 = check(n, m, k); v.clear(); v.push_back(add_not(ans2)); v.push_back(ans1); add_and(v); return ; }
#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...