Submission #316696

#TimeUsernameProblemLanguageResultExecution timeMemory
316696tengiz05Vision Program (IOI19_vision)C++17
0 / 100
2 ms1276 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; int posl[405][405], posr[405][405]; int h, w; int pos(int i, int j){ return i*w+j; } void construct_network(int n, int m, int k) { h = n, w = m; int timer = n*m; for(int p=0;p<n;p++){ int i=p,j=0; posl[i][j] = add_or({pos(i,j)}); i--,j++; timer++; while(i >= 0 && j < m){ posl[i][j] = add_or({timer-1, pos(i, j)});timer++; i--, j++; } }for(int p=1;p<m;p++){ int i=n-1,j=p; posl[i][j] = add_or({pos(i,j)}); i--,j++; timer++; while(i >= 0 && j < m){ posl[i][j] = add_or({timer-1, pos(i, j)}); timer++; i--, j++; } } for(int p=0;p<n;p++){ int i=p,j=0; posl[i][j] = add_or({pos(i,j)}); i++,j++; timer++; while(i < n && j < m){ posr[i][j] = add_or({timer-1, pos(i, j)});timer++; i++, j++; } }for(int p=1;p<m;p++){ int i=0,j=p; posr[i][j] = add_or({pos(i,j)}); i++,j++; timer++; while(i < n && j < m){ posr[i][j] = add_or({timer-1, pos(i, j)});timer++; i++, j++; } } vector<int> v; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ int x1 = i+k, y1 = j; while(x1 > i && y1+1 < m)x1--, y1++; int x2 =x1, y2 = y1; while(x2+1 < n && y2 > j)x2++, y2--; if(x1 < n && y1 < m && x1 >= 0 && y1 >= 0){ if(x2+1 < n || y2-1 >= 0){ int t1 = add_not(posl[x2+1][y2-1]); int t = add_and({t1, posl[x1][y1], pos(i, j)}); v.push_back(t); }else { int t = add_and({posl[x1][y1], pos(i, j)}); v.push_back(t); } //cout << x1 << ' ' << y1 << "; " << x2 << ' ' << y2 << '\n'; }x1 = i, y1 = j-k; while(x1+1 < n && y1 < j)x1++, y1++; x2 = x1, y2=y1; while(x2 > i && y2-1 >= 0)x2--, y2--; if(x1 < n && y1 < m && x1 >= 0 && y1 >= 0){ if(x2-1 >= 0 || y2-1 >= 0){ int t1 = add_not(posr[x2-1][y2-1]); int t = add_and({t1, posr[x1][y1], pos(i, j)}); v.push_back(t); }else { int t = add_and({posr[x1][y1], pos(i, j)}); v.push_back(t); }//cout << x1 << ' ' << y1 << "; " << x2 << ' ' << y2 << "\n\n"; } } }add_or(v); }
#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...