제출 #975463

#제출 시각아이디문제언어결과실행 시간메모리
975463yellowtoadVision Program (IOI19_vision)C++17
14 / 100
15 ms2140 KiB
#include "vision.h" #include <iostream> #include <vector> #define andd add_and #define orr add_or #define xorr add_xor using namespace std; int vert[210], hor[210], u[210], d[210], l[210], r[210], pos, xx[410], yy[410], x, y; vector<int> tmp, ns; void construct_network(int n, int m, int k) { for (int i = 0; i < n; i++) { tmp.clear(); for (int j = 0; j < m; j++) tmp.push_back(i*m+j); hor[i] = orr(tmp); } u[0] = hor[0]; d[n-1] = hor[n-1]; for (int i = 1; i < n; i++) u[i] = orr({u[i-1],hor[i]}); for (int i = n-2; i >= 0; i--) d[i] = orr({d[i+1],hor[i]}); for (int i = k+1; i < n; i++) ns.push_back(andd({hor[i],u[i-k-1]})); for (int i = n-k-2; i >= 0; i--) ns.push_back(andd({hor[i],d[i+k+1]})); for (int i = 0; i < m; i++) { tmp.clear(); for (int j = 0; j < n; j++) tmp.push_back(j*m+i); vert[i] = orr(tmp); } l[0] = vert[0]; r[m-1] = vert[m-1]; for (int i = 1; i < m; i++) l[i] = orr({l[i-1],vert[i]}); for (int i = m-2; i >= 0; i--) r[i] = orr({r[i+1],vert[i]}); for (int i = k+1; i < m; i++) ns.push_back(andd({vert[i],l[i-k-1]})); for (int i = m-k-2; i >= 0; i--) ns.push_back(andd({vert[i],r[i+k+1]})); if (ns.size()) pos = add_not(orr(ns)); ns.clear(); for (int i = 0; i <= 400; i++) { tmp.clear(); x = n; y = i; while ((x >= 0) && (y >= 0)) { if ((x < n) && (y < m)) tmp.push_back(x*m+y); x--; y--; } if (tmp.size()) xx[i] = orr(tmp); } for (int i = 0; xx[i+k]; i++) ns.push_back(andd({xx[i],xx[i+k]})); for (int i = 0; i <= 400; i++) { tmp.clear(); x = 0; y = i; while ((x < n) && (y >= 0)) { if ((0 <= x) && (y < m)) tmp.push_back(x*m+y); x++; y--; } if (tmp.size()) yy[i] = orr(tmp); } for (int i = 0; yy[i+k]; i++) ns.push_back(andd({yy[i],yy[i+k]})); if (pos) andd({pos,orr(ns)}); else orr(ns); }
#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...