Submission #146657

#TimeUsernameProblemLanguageResultExecution timeMemory
146657jwvg0425Vision Program (IOI19_vision)C++17
26 / 100
13 ms1400 KiB
#include "vision.h" #include <stdio.h> #include <vector> #include <queue> #include <algorithm> #include <iostream> #include <string> #include <bitset> #include <map> #include <set> #include <tuple> #include <string.h> #include <math.h> #include <random> #include <functional> #include <assert.h> #include <math.h> #define all(x) (x).begin(), (x).end() #define xx first #define yy second using namespace std; using i64 = long long int; using ii = pair<int, int>; using ii64 = pair<i64, i64>; int h, w, k; int cell(int x, int y) { return y * w + x; } vector<int> range(int s, int e) { vector<int> v; for (int i = s; i <= e; i++) v.push_back(i); return v; } int xcell(int x) { return h * w + x; } int ycell(int y) { return h * w + w + y; } // x + y = v인 셀 vector<int> allXPY(int v) { vector<int> res; for (int x = 0; x < w; x++) { int y = v - x; if (y >= h || y < 0) continue; res.push_back(cell(x, y)); } return res; } // x - y = v인 셀 vector<int> allXMY(int v) { vector<int> res; for (int x = 0; x < w; x++) { int y = x - v; if (y >= h || y < 0) continue; res.push_back(cell(x, y)); } return res; } int xpy[405]; int xmy[405]; void construct_network(int H, int W, int K) { h = H; w = W; k = K; for (int v = 0; v <= H + W - 2; v++) xpy[v] = add_or(allXPY(v)); for (int v = -(H-1); v <= W - 1; v++) xmy[v + 202] = add_or(allXMY(v)); // 각각 정확히 k, k 이하 int xpyk, xpykle; int xmyk, xmykle; vector<int> qs; for (int v = k; v <= H + W - 2; v++) qs.push_back(add_and({ xpy[v], xpy[v - k] })); xpyk = add_or(qs); qs.clear(); for (int v = k; v <= H + W - 2; v++) { int r = add_or(range(xpy[v - k], xpy[v - 1])); qs.push_back(add_and({ r, xpy[v] })); } // 딱 하나 (x+y값 일치 두 개) qs.push_back(add_xor(range(xpy[0], xpy[H + W - 2]))); xpykle = add_or(qs); qs.clear(); for (int v = -(H - 1) + k; v <= W - 1; v++) qs.push_back(add_and({ xmy[v + 202], xmy[v - k + 202] })); xmyk = add_or(qs); qs.clear(); for (int v = -(H - 1) + k; v <= W - 1; v++) { int r = add_or(range(xmy[v - k + 202], xmy[v - 1 + 202])); qs.push_back(add_and({ r, xmy[v + 202] })); } qs.push_back(add_xor(range(xmy[-(H - 1) + 202], xmy[W - 1 + 202]))); xmykle = add_or(qs); qs.clear(); int p = add_and({ xpyk, xmykle }); int m = add_and({ xmyk, xpykle }); add_or({ p,m }); }
#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...