Submission #1028562

#TimeUsernameProblemLanguageResultExecution timeMemory
1028562onbertVision Program (IOI19_vision)C++17
100 / 100
23 ms3420 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; int n, m; int id(int x, int y) { return x*m + y; } void construct_network(int N, int M, int k) { n = N, m = M; int nn[2] = {n, m}; int ok[4]; for (int I=0;I<=1;I++) { int sz = nn[I], kn = min(k, sz-1); vector<int> OR(sz), XOR(sz), NOTXOR(sz), TWO(sz), range; for (int i=0;i<sz;i++) { vector<int> cur; if (I==0) for (int j=0;j<m;j++) cur.push_back(id(i, j)); else for (int j=0;j<n;j++) cur.push_back(id(j, i)); OR[i] = add_or(cur); XOR[i] = add_xor(cur); NOTXOR[i] = add_not(XOR[i]); TWO[i] = add_and({NOTXOR[i], OR[i]}); } for (int l=0, r=kn; r<sz; l++, r++) { // if (I==1) cout << l << " " << r << endl; vector<int> cur; for (int j=l;j<=r;j++) cur.push_back({OR[j]}); int x = add_or(cur), y = add_xor(cur), z = add_not(y); range.push_back(add_and({x, z})); } vector<int> ck = TWO; for (int x:range) ck.push_back(x); ok[I] = add_or(ck); } for (int I=2;I<=3;I++) { int sz = nn[I]; vector<int> OR; if (I==2) { for (int i=-n;i<m;i++) { vector<int> cur; for (int x=0, y=i; x<n; x++, y++) { if (x>=0 && x<n && y>=0 && y<m) cur.push_back(id(x, y)); } if (cur.size()!=0) OR.push_back(add_or(cur)); } } else if (I==3) { for (int i=0;i<m+n+5;i++) { vector<int> cur; for (int x=0, y=i; x<n; x++, y--) { if (x>=0 && x<n && y>=0 && y<m) cur.push_back(id(x, y)); } if (cur.size()!=0) OR.push_back(add_or(cur)); } } vector<int> range; for (int l=0, r=k; r<OR.size(); l++, r++) { // cout << l << " " << r << endl; range.push_back(add_and({OR[l], OR[r]})); } ok[I] = add_or(range); } int diag = add_or({ok[2], ok[3]}); int a = add_and({ok[0]}), b = add_and({ok[1]}), c = add_and({ok[2]}), d = add_and({ok[3]}); int ans = add_and({ok[0], ok[1], diag}); }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:57:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |         for (int l=0, r=k; r<OR.size(); l++, r++) {
      |                            ~^~~~~~~~~~
vision.cpp:37:13: warning: unused variable 'sz' [-Wunused-variable]
   37 |         int sz = nn[I];
      |             ^~
vision.cpp:64:9: warning: unused variable 'a' [-Wunused-variable]
   64 |     int a = add_and({ok[0]}), b = add_and({ok[1]}), c = add_and({ok[2]}), d = add_and({ok[3]});
      |         ^
vision.cpp:64:31: warning: unused variable 'b' [-Wunused-variable]
   64 |     int a = add_and({ok[0]}), b = add_and({ok[1]}), c = add_and({ok[2]}), d = add_and({ok[3]});
      |                               ^
vision.cpp:64:53: warning: unused variable 'c' [-Wunused-variable]
   64 |     int a = add_and({ok[0]}), b = add_and({ok[1]}), c = add_and({ok[2]}), d = add_and({ok[3]});
      |                                                     ^
vision.cpp:64:75: warning: unused variable 'd' [-Wunused-variable]
   64 |     int a = add_and({ok[0]}), b = add_and({ok[1]}), c = add_and({ok[2]}), d = add_and({ok[3]});
      |                                                                           ^
vision.cpp:65:9: warning: unused variable 'ans' [-Wunused-variable]
   65 |     int ans = add_and({ok[0], ok[1], diag});
      |         ^~~
#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...