제출 #201291

#제출 시각아이디문제언어결과실행 시간메모리
201291khulegubVision Program (IOI19_vision)C++14
0 / 100
18 ms1776 KiB
#include "vision.h" #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define rr first #define cc second using namespace std; typedef pair<int, int> pii; int hh, ww, kk; pii to_pair(int x){ return mp(x / ww, x % ww); } int to_linear(pii x){ return x.rr * ww + x.cc; } void construct_network(int H, int W, int K) { // proj y hh = H, ww = W, kk = K; int one = add_or( {0, 1} ), zero = add_not(one); vector<int> proj_y; for (int i = 0; i < ww; i++){ vector<int> send; for (int j = 0; j < hh; j++){ send.pb(to_linear(mp(i, j))); } proj_y.pb(add_xor(send)); } vector<int> proj_x; for (int i = 0; i < hh; i++){ vector<int> send; for (int j = 0; j < ww; j++){ send.pb(to_linear(mp(j, i))); } proj_x.pb(add_xor(send)); } // // max val = h + w // // log_2 (400) + 1 = 9 int bitlen = 10; vector<int> counter; for (int i = 0; i < bitlen; i++){ counter.pb(add_and({zero, 0})); } for (int j = 0; j < ww; j++){ int adder = proj_y[j]; for (int i = 0; i < bitlen; i++){ int tmp = counter[i]; counter[i] = add_xor({counter[i], adder}); adder = add_and({tmp, adder}); } } for (int j = 0; j < hh; j++){ int adder = proj_x[j]; for (int i = 0; i < bitlen; i++){ int tmp = counter[i]; counter[i] = add_xor({counter[i], adder}); adder = add_and({tmp, adder}); } } kk = kk + 2; int last = one; vector<int> kkbits; for (int i = 0; i < bitlen; i++){ kkbits.pb((kk & 1) ? (one) : (zero)); kk >>= 1; } int surpass = zero; for (int i = bitlen - 1; i >= 0; i--){ int cmp = add_xor({counter[i], kkbits[i]}); cmp = add_not(cmp); //this is saved by switching the k % 2 outcome cmp = add_or({cmp, counter[i]}); surpass = add_or({surpass, cmp}); last = add_and({last, surpass}); } }
#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...