Submission #239107

#TimeUsernameProblemLanguageResultExecution timeMemory
239107zoooma13Vision Program (IOI19_vision)C++14
44 / 100
554 ms3060 KiB
#include <bits/stdc++.h> #include "vision.h" //#include "grader.cpp" using namespace std; int h ,w ,k; int d(int i ,int j){ return i*w+j; } int dist(int r ,int c ,int i ,int j){ return abs(r-i) + abs(j-c); } vector <int> getAt(int r ,int c){ vector <int> ret; for(int i=r; i<h; i++) for(int j=0; j<w; j++) if(!(i==r&&j==c-k) && dist(i ,j ,r ,c) == k) ret.push_back(d(i ,j)); return ret; } void construct_network(int H, int W, int K) { h=H ,w=W ,k=K; vector<vector <int>> diags(H ,vector<int>(W ,-1)); int id = h*w; for(int i=0; i<h; i++) for(int j=0; j<w; j++){ auto nb = getAt(i ,j); if(nb.size()) add_or(nb) ,diags[i][j] = id++; } vector<vector <int>> prs(H ,vector<int>(W ,-1)); for(int i=0; i<h; i++) for(int j=0; j<w; j++) if(~diags[i][j]) add_and({d(i ,j) ,diags[i][j]}) ,prs[i][j] = id++; vector<int> tot; for(auto&v : prs) for(auto&i : v) if(~i) tot.push_back(i); add_or(tot); }
#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...