Submission #799121

#TimeUsernameProblemLanguageResultExecution timeMemory
799121I_Love_EliskaM_Vision Program (IOI19_vision)C++14
100 / 100
17 ms1988 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; #define forn(i,n) for(int i=0; i<n; ++i) #define pb push_back int zero, one; vector<int> add(vector<int> f, vector<int> s) { int n=9; int temp=zero; vector<int> ret; forn(i,n) { ret.pb(add_xor({temp,f[i],s[i]})); temp = add_or({add_and({f[i],s[i]}), add_and({temp,add_or({f[i],s[i]})})}); } return ret; } void construct_network(int n, int m, int k) { if (n*m==2) { add_or({0,1}); return; } if (1) { vector<int> v; forn(i,n) forn(j,m) v.pb(i*m+j); zero=add_and(v); one=add_not(zero); } vector<int> row_xor, col_xor; forn(j,m) { vector<int> v; forn(i,n) v.pb(i*m+j); col_xor.pb(add_xor(v)); } forn(i,n) { vector<int> v; forn(j,m) v.pb(i*m+j); row_xor.pb(add_xor(v)); } vector<int> rf,rs,cf,cs; vector<int> row_pr = {zero}; vector<int> col_pr = {zero}; forn(i,n) row_pr.pb(add_xor({row_pr[i],row_xor[i]})); forn(i,m) col_pr.pb(add_xor({col_pr[i],col_xor[i]})); int t=9; vector<vector<int>> z(t,{zero}); forn(i,n) { forn(j,t) { if ((i>>j)&1) { z[j].pb(add_and({row_pr[i+1],row_xor[i]})); } } } forn(i,t) { rf.pb(add_or(z[i])); z[i]={zero}; } forn(i,n) { forn(j,t) { if ((i>>j)&1) { z[j].pb(add_and({add_not(row_pr[i+1]),row_xor[i]})); } } } forn(i,t) { rs.pb(add_or(z[i])); z[i]={zero}; } forn(i,m) { forn(j,t) { if ((i>>j)&1) { z[j].pb(add_and({col_pr[i+1],col_xor[i]})); } } } forn(i,t) { cf.pb(add_or(z[i])); z[i]={zero}; } forn(i,m) { forn(j,t) { if ((i>>j)&1) { z[j].pb(add_and({add_not(col_pr[i+1]),col_xor[i]})); } } } forn(i,t) { cs.pb(add_or(z[i])); z[i]={zero}; } auto sumf = add(rf,cf); auto sums = add(rs,cs); vector<int> kb; forn(i,t) { if ((k>>i)&1) kb.pb(one); else kb.pb(zero); } auto qq = add(sumf,kb); vector<int> zz; forn(i,t) { zz.pb(add_xor({qq[i],sums[i]})); } add_not(add_or(zz)); }
#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...