Submission #425815

#TimeUsernameProblemLanguageResultExecution timeMemory
425815alishahali1382Vision Program (IOI19_vision)C++17
0 / 100
11 ms1220 KiB
#include "vision.h" #include<bits/stdc++.h> #pragma GCC optimize("O2") using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; typedef vector<int> vi; #define debug(x) {cerr<<#x<<"="<<x<<"\n";} #define debug2(x, y) {cerr<<"{"<<#x<<", "<<#y<<"}={"<<x<<", "<<y<<"}\n";} #define debugp(p) {cerr<<#p<<"={"<<p.first<<", "<<p.second<<"}\n";} #define debugv(abcd) {cerr<<#abcd<<": ";for (auto dcba:abcd) cerr<<dcba<<", ";cerr<<"\n";} #define pb push_back #define SZ(x) ((int)x.size()) #define all(x) x.begin(), x.end() const int inf=1000001000; // 1e9 const ll INF=10000000010000000; // 1e16 const int mod=1000000007; const int MAXN=100010; int n, m, k; inline int get_id(int x, int y){ return x*m+y;} int add_and(int x, int y){ return add_and({x, y});} int add_or(int x, int y){ return add_or({x, y});} void construct_network(int _n, int _m, int _k){ n=_n; m=_m; k=_k; int zero=add_and(0, add_not(0)); int one=add_not(zero); one=one; zero=zero; //fucking warnings vi X, Y; for (int i=0; i<n; i++){ vi shit(m); for (int j=0; j<m; j++) shit[j]=get_id(i, j); X.pb(add_or(shit)); } for (int j=0; j<m; j++){ vi shit(n); for (int i=0; i<n; i++) shit[i]=get_id(i, j); Y.pb(add_or(shit)); } vi DX(n, zero), DY(m, zero); DX[0]=DY[0]=one; int diff_x=add_not(add_xor(X)); for (int d=min(k+1, n-1); d; d--){ vi shit; for (int i=0; i*d<n; i++){ vi shit2; for (int j=0; j<n; j++) if (j/d==i) shit2.pb(X[j]); shit.pb(add_or(shit2)); } DX[d]=add_and(add_not(add_xor(shit)), diff_x); if (d<n-1) DX[d]=add_or(DX[d], DX[d+1]); } for (int d=min(k+1, m-1); d; d--){ vi shit; for (int i=0; i+d<m; i++){ shit.pb(add_and(Y[i], Y[i+d])); } if (d<m-1) shit.pb(DY[d+1]); DY[d]=add_or(shit); } // debug(DY[1]-n*m+1) // optimize for d=0 case // debugv(X) // debugv(Y) // debugv(DX) // debugv(DY) vi A, B; for (int i=0; i<n; i++) for (int j=0; j<m; j++){ if (i+j==k) A.pb(add_and(DX[i], DY[j])); if (i+j==k+1) B.pb(add_and(DX[i], DY[j])); } // debug("shit") int a=add_or(A); int b=(B.empty()?zero:add_or(B)); int ted=add_and(a, add_not(b)); debug(ted+1-n*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...