Submission #1046870

#TimeUsernameProblemLanguageResultExecution timeMemory
1046870MalixVision Program (IOI19_vision)C++14
41 / 100
2 ms464 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vii; typedef pair<int,int> pi; typedef vector<pi> pii; typedef tuple<int,int,int> tii; #define REP(i,a,b) for(int i=a;i<b;i++) #define F first #define S second #define PB push_back #define MP make_pair #define LSOne(s) ((s)&(-s)) ll INF=1e18+10; int inf=1e9+10; ll M=1e9+7; void construct_network(int H, int W, int K) { if(min(H,W)==1||H*W<=100){ set<pi> a; REP(i,0,H){ REP(j,0,W){ int x=W*i+j; REP(k,0,K+1){ int y=W*(i+k)+j+(K-k); if(i+k<H&&i+k>=0&&j+K-k>=0&&j+K-k<W&&y<H*W&&y>=0){ if(x<y)a.insert({x,y}); else a.insert({y,x}); } y=W*(i-k)+j+(K-k); if(i-k<H&&i-k>=0&&j+K-k>=0&&j+K-k<W&&y<H*W&&y>=0){ if(x<y)a.insert({x,y}); else a.insert({y,x}); } y=W*(i+k)+j-(K-k); if(i+k<H&&i+k>=0&&j-(K-k)>=0&&j-(K-k)<W&&y<H*W&&y>=0){ if(x<y)a.insert({x,y}); else a.insert({y,x}); } y=W*(i-k)+j-(K-k); if(i-k<H&&i-k>=0&&j-(K-k)>=0&&j-(K-k)<W&&y<H*W&&y>=0){ if(x<y)a.insert({x,y}); else a.insert({y,x}); } } } } vi b,c; for(auto u:a){ b.clear(); b.PB(u.F); b.PB(u.S);cerr<<b[0]<<" "<<b[1]<<"\n"; int x=add_and(b); c.PB(x); } if(c.empty()){ int x=add_not(0); c.PB(x);c.PB(0); add_and(c); } else add_or(c); return; } set<pi> a; int i=0,j=0; int x=W*i+j; REP(k,0,K+1){ int y=W*(i+k)+j+(K-k); if(i+k<H&&i+k>=0&&j+K-k>=0&&j+K-k<W&&y<H*W&&y>=0){ if(x<y)a.insert({x,y}); else a.insert({y,x}); } y=W*(i-k)+j+(K-k); if(i-k<H&&i-k>=0&&j+K-k>=0&&j+K-k<W&&y<H*W&&y>=0){ if(x<y)a.insert({x,y}); else a.insert({y,x}); } y=W*(i+k)+j-(K-k); if(i+k<H&&i+k>=0&&j-(K-k)>=0&&j-(K-k)<W&&y<H*W&&y>=0){ if(x<y)a.insert({x,y}); else a.insert({y,x}); } y=W*(i-k)+j-(K-k); if(i-k<H&&i-k>=0&&j-(K-k)>=0&&j-(K-k)<W&&y<H*W&&y>=0){ if(x<y)a.insert({x,y}); else a.insert({y,x}); } } vi b,c; for(auto u:a){ b.clear(); b.PB(u.F); b.PB(u.S); int x=add_and(b); c.PB(x); } if(c.empty()){ int x=add_not(0); c.PB(x);c.PB(0); add_and(c); } else add_or(c); }
#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...