Submission #1048670

#TimeUsernameProblemLanguageResultExecution timeMemory
1048670MercubytheFirstVision Program (IOI19_vision)C++17
33 / 100
383 ms1160 KiB
#include "bits/stdc++.h" #include "vision.h" #define pb push_back #define endl '\n' #define fi first #define se second #define CDIV(a,b) (((a)+(b)-(1))/(b)) using ll = long long; using ld = long double; const ll inf = 1e17 + 37; const ll mod = 1e9 + 7; const ll N = 3000 + 1; const ld eps = 1e-9; const ld PI = acos((ld)-1); template<typename T, size_t N> std::ostream& operator<<(std::ostream& os, const std::array<T, N>& a); template<typename T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& v); template<typename T1, typename T2> std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p); template<typename T> std::ostream& operator<<(std::ostream& os, const std::set<T>& s); template<typename T, typename cmp> std::ostream& operator<<(std::ostream& os, const std::set<T, cmp>& s); using namespace std; void construct_network(int H, int W, int K) { std::vector<int> Ns; auto dist = [&] (int p1, int p2) -> int { int x = p1 / W, y = p1 % W; int xx = p2 / W, yy = p2 % W; // cout << x << ' ' << y << " : " << xx << ' ' << yy << ' ' << abs(x - xx) + abs(y - yy) << endl; return abs(x - xx) + abs(y - yy); }; int last = H * W; for(int i = 0; i < H*W; ++i) { for(int j = 0; j < H*W; ++j) { if(j == i){ continue; } if(dist(i, j) == K) { add_and({i, j}); last++; } } } for(int i = H*W; i < last; ++i) Ns.push_back(i); add_or(Ns); } template<typename T, size_t N> std::ostream& operator<<(std::ostream& os, const std::array<T, N>& a) { os << "["; for(size_t i = 0; i + 1 < N; ++i) { os << a[i] << ", "; } if(N > 0) os << a[N - 1]; os << "]"; return os; } template<typename T1, typename T2> std::ostream& operator<<(std::ostream& os, const std::pair<T1, T2>& p) { os << "(" << p.first << ", " << p.second << ") "; return os; } template<typename T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) { os << '['; for(auto x : v) os << x << ", "; os << "] "; return os; } template<typename T> std::ostream& operator<<(std::ostream& os, const std::set<T>& s) { os << "{"; for(auto x : s) os << x << ", "; os << "} "; return os; } // template<typename T, typename cmp> std::ostream& operator<<(std::ostream& os, const std::set<T, cmp>& s) { os << "{"; for(auto x : s) os << x << ", "; os << "} "; return os; }
#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...