Submission #210334

#TimeUsernameProblemLanguageResultExecution timeMemory
210334SegtreeVision Program (IOI19_vision)C++14
100 / 100
79 ms4472 KiB
#include "vision.h" #include<iostream> #include<algorithm> #include<vector> #include<queue> #include<set> #include<unordered_set> #include<unordered_map> #include<cassert> #include<stack> #include<fstream> using namespace std; typedef long long ll; typedef pair<ll,ll> P; #define rep(i,n) for(int i=0;i<n;i++) #define all(x) x.begin(),x.end() #define chmin(a,b) a=min(a,b) #define chmax(a,b) a=max(a,b) void construct_network(int H, int W, int K) { vector<int> Ns; int T=H+W-1; for(int s=0;s<T;s++){ Ns.clear(); rep(i,H)rep(j,W)if(i+j==s)Ns.push_back(i*W+j); add_or(Ns); } for(int s=0;s<T;s++){ Ns.clear(); rep(i,H)rep(j,W)if(i-j+W-1==s)Ns.push_back(i*W+j); add_or(Ns); } int qid; for(int s=0;s+K<T;s++){ Ns.clear(); Ns={H*W+s,H*W+s+K}; qid=add_and(Ns); } Ns.clear(); for(int s=H*W+2*T;s<=qid;s++)Ns.push_back(s); int x_k=add_or(Ns);//xの距離がちょうどkなら1 for(int s=0;s+K<T;s++){ Ns.clear(); Ns={H*W+T+s,H*W+T+s+K}; qid=add_and(Ns); } Ns.clear(); for(int s=x_k+1;s<=qid;s++)Ns.push_back(s); int y_k=add_or(Ns);//yの距離がちょうどkなら1 if(K==T-1){ Ns.clear(); Ns.push_back(x_k); Ns.push_back(y_k); add_or(Ns); return; } for(int s=0;s+K<T;s++){ Ns.clear(); for(int i=0;i<s;i++)Ns.push_back(i+H*W); for(int i=s+K+1;i<T;i++)Ns.push_back(i+H*W); qid=add_or(Ns); } Ns.clear(); for(int i=y_k+1;i<=qid;i++)Ns.push_back(i); int x_kinai=add_and(Ns);//xの距離がK以下なら0 for(int s=0;s+K<T;s++){ Ns.clear(); for(int i=0;i<s;i++)Ns.push_back(i+T+H*W); for(int i=s+K+1;i<T;i++)Ns.push_back(i+T+H*W); qid=add_or(Ns); } Ns.clear(); for(int i=x_kinai+1;i<=qid;i++)Ns.push_back(i); int y_kinai=add_and(Ns);//yの距離がK以下なら0 int x_kinai_rev=add_not(x_kinai); int y_kinai_rev=add_not(y_kinai); Ns.clear(); Ns.push_back(x_k); Ns.push_back(y_kinai_rev); int vl=add_and(Ns); Ns.clear(); Ns.push_back(y_k); Ns.push_back(x_kinai_rev); int vr=add_and(Ns); Ns.clear(); Ns.push_back(vl); Ns.push_back(vr); add_or(Ns); }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:40:21: warning: 'qid' may be used uninitialized in this function [-Wmaybe-uninitialized]
  for(int s=H*W+2*T;s<=qid;s++)Ns.push_back(s);
                    ~^~~~~
#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...