Submission #981192

#TimeUsernameProblemLanguageResultExecution timeMemory
981192WongYiKaiVision Program (IOI19_vision)C++14
73 / 100
67 ms6604 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; void construct_network(int H, int W, int K) { int count=0,count2=0; map<int,pair<int,int>> left,right; for (int j=-H+1;j<W;j++){ vector<int> n; int x=j,y=0; while (y<H){ if (x>=0&&x<W) n.push_back(y*W+x); y++; x++; } count += 2; count2 += n.size()*2; int a = add_or(n); int b = add_xor(n); right[-j] = {a,b}; } for (int j=0;j<W+H-1;j++){ vector<int> n; int x=j,y=0; while (y<H){ if (x>=0&&x<W) n.push_back(y*W+x); y++; x--; } count += 2; count2 += n.size()*2; int a = add_or(n); int b = add_xor(n); left[j] = {a,b}; } vector<int> temp,temp2; for (int i=H-1;i>-W-K;i--){ vector<int> n,n2; for (int j=i+K;j>=i;j--){ if (right[j].first==right[j].second) continue; n.push_back(right[j].first); n2.push_back(right[j].second); } count += 4; count2 += n.size()+n2.size()+3; int a = add_or(n); int b = add_xor(n2); int c = add_not(b); int d = add_and({a,c}); temp.push_back(d); } for (int i=0;i<W+H+K-1;i++){ vector<int> n,n2; for (int j=i;j>=i-K;j--){ if (left[j].first==left[j].second) continue; n.push_back(left[j].first); n2.push_back(left[j].second); } count += 4; count2 += n.size()*2+3; int a = add_or(n); int b = add_xor(n2); int c = add_not(b); int d = add_and({a,c}); temp2.push_back(d); } count += 3; count2 += temp.size()+temp2.size()+2; int a = add_or(temp); int b = add_or(temp2); int e = add_and({a,b}); temp.clear(); temp2.clear(); for (int i=H-1;i>-W-K+1;i--){ vector<int> n,n2; for (int j=i+K-1;j>=i;j--){ if (right[j].first==right[j].second) continue; n.push_back(right[j].first); n2.push_back(right[j].second); } count += 4; count2 += n.size()*2+3; int a = add_or(n); int b = add_xor(n2); int c = add_not(b); int d = add_and({a,c}); temp.push_back(d); } for (int i=0;i<W+H+K-2;i++){ vector<int> n,n2; for (int j=i;j>i-K;j--){ if (left[j].first==left[j].second) continue; n.push_back(left[j].first); n2.push_back(left[j].second); } count += 4; count2 += n.size()*2+3; int a = add_or(n); int b = add_xor(n2); int c = add_not(b); int d = add_and({a,c}); temp2.push_back(d); } count += 5; count2 += temp.size() + temp2.size() + 5; a = add_or(temp); b = add_or(temp2); int e2 = add_and({a,b}); int e3 = add_not(e2); int aa = add_and({e,e3}); //cout << count << " " << count2 << "\n"; }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:110:6: warning: unused variable 'aa' [-Wunused-variable]
  110 |  int aa = add_and({e,e3});
      |      ^~
#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...