Submission #832357

#TimeUsernameProblemLanguageResultExecution timeMemory
832357maomao90Vision Program (IOI19_vision)C++17
0 / 100
8 ms1152 KiB
// I can do all things through Christ who strenghthens me // Philippians 4:13 #include "bits/stdc++.h" #include "vision.h" using namespace std; #define REP(i, j, k) for (int i = j; i < (k); i++) #define RREP(i, j, k) for (int i = j; i >= (k); i--) template <class T> inline bool mnto(T &a, const T b) {return a > b ? a = b, 1 : 0;} template <class T> inline bool mxto(T &a, const T b) {return a < b ? a = b, 1 : 0;} typedef long long ll; typedef long double ld; #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; #define ALL(x) x.begin(), x.end() #define SZ(x) (int) x.size() #define pb push_back typedef vector<int> vi; typedef vector<ii> vii; typedef vector<ll> vll; typedef tuple<int, int, int> iii; typedef vector<iii> viii; #ifndef DEBUG #define cerr if (0) cerr #endif const int INF = 1000000005; const ll LINF = 1000000000000000005; const int MAXN = 200005; int h, w, k; void construct_network(int H, int W, int K) { h = H, w = W; k = K; if (k == 1) { int hs = h * w; REP (i, 0, h) { vi v(w); iota(ALL(v), i * w); add_or(v); } int ws = hs + w; REP (j, 0, w) { vi v; REP (i, 0, h) { v.pb(i * w + j); } add_or(v); } vi hall; REP (i, 0, h - 1) { hall.pb(add_and({hs + i, hs + i + 1})); } int hb = add_or(hall); vi wall; REP (i, 0, w - 1) { wall.pb(add_and({ws + i, ws + i + 1})); } int wb = add_or(wall); int o = add_or({hb, wb}); int a = add_and({hb, wb}); a = add_not(a); add_and({o, a}); /* vi v1, v2; REP (i, 0, h) { REP (j, 0, w) { if (i + j & 1) { v1.pb(i * w + j); } else { v2.pb(i * w + j); } } } int t1 = add_or(v1), t2 = add_or(v2); add_and({wb, hb, t1, t2}); */ return; } vi all; REP (i, 0, h) { REP (j, 0, w) { if (max(h, w) > 30 && min(h, w) != 1 && j != 0) { break; } vi v; REP (ni, 0, h) { if (abs(ni - i) > k) { continue; } { // abs(ni - i) + nj - j = k // nj = k - abs(ni - i) + j int nj = k - abs(ni - i) + j; if (nj >= 0 && nj < w) { v.pb(ni * w + nj); } } } if (v.empty()) { continue; } int tmp = add_or(v); all.pb(add_and({i * w + j, tmp})); } } add_or(all); }
#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...