제출 #600416

#제출 시각아이디문제언어결과실행 시간메모리
600416MohamedFaresNebiliVision Program (IOI19_vision)C++14
0 / 100
4 ms340 KiB
#include <bits/stdc++.h> #include "vision.h" /// #pragma GCC optimize ("Ofast") /// #pragma GCC target ("avx2") /// #pragma GCC optimize("unroll-loops") using namespace std; using ll = long long; using ld = long double; using ii = pair<ll, ll>; using vi = vector<int>; #define ff first #define ss second #define pb push_back #define all(x) (x).begin(), (x).end() #define lb lower_bound const int MOD = 1e9 + 7; int H, W; map<int, int> A[2], B[2]; int calc(int x, int y) { return x * W + y; } int dist(int x, int y, int X, int Y) { return abs(x - X) + abs(y - Y); } int solve(int K) { vector<int> U, V; for(int l = -(H + W); l < (H + W); l++) { if(l + K - 1 < H + W) { vector<int> X, Y; for(int i = l; i < l + K; i++) X.push_back(A[i][0]), Y.push_back(A[i][1]); int C = add_xor({add_or(X), add_xor(X)}); Y.push_back(C); U.push_back(add_or(Y)); } } for(int l = 0; l < H + W; l++) { if(l + K - 1 < H + W) { vector<int> X, Y; for(int i = l; i < l + K; i++) X.push_back(B[i][0]), Y.push_back(B[i][1]); int C = add_xor({add_or(X), add_xor(X)}); Y.push_back(C); V.push_back(add_or(Y)); } } return add_and({add_or(U), add_or(V)}); } void construct_network(int h, int w, int K) { H = h, ::W = w; for(int l = -(H + W); l < (H + W); l++) { vector<int> V; for(int i = 0; i < H; i++) { for(int j = 0; j < W; j++) { if(i - j != l) continue; V.push_back(calc(i, j)); } } if(V.empty()) continue; A[l][0] = add_or(V); A[l][1] = add_xor({A[l][0], add_xor(V)}); } for(int l = 0; l < (H + W); l++) { vector<int> V; for(int i = 0; i < H; i++) { for(int j = 0; j < W; j++) { if(i + j != l) continue; V.push_back(calc(i, j)); } } if(V.empty()) continue; B[l][0] = add_or(V); B[l][1] = add_xor({B[l][0], add_xor(V)}); } add_and({solve(K + 1), add_not(solve(K))}); }
#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...