Submission #430458

#TimeUsernameProblemLanguageResultExecution timeMemory
430458p_squareVision Program (IOI19_vision)C++14
12 / 100
253 ms1348 KiB
#include <vision.h> #include <bits/stdc++.h> using namespace std; #define mp make_pair #define fi first #define se second int h; int w; int k; int cnum(int i, int j) { return i*w + j; } void opt(vector <int> qry) { for(int i = 0; i<qry.size(); i++) { cerr<<qry[i]<<" "; } } void construct_network(int H, int W, int K) { h = H; w = W; k = K; int row, col, reply, NWd = h*w, NEd = h*w+h+w-1, cr1be, cr1en, cr1; vector <int> qry; for(int diag = 0; diag<h+w-1; diag++) { qry.clear(); for(row = 0; row<h; row++) { col = diag - row; if(col >= 0 && col < w) { qry.push_back(cnum(row, col)); } } assert(!qry.empty()); reply = add_xor(qry); } for(int diag = 0; diag<h+w-1; diag++) { qry.clear(); for(row = 0; row<h; row++) { col = w + row - diag - 1; if(col >= 0 && col < w) { cerr<<row<<" "<<col<<endl; qry.push_back(cnum(row, col)); } } assert(!qry.empty()); reply = add_xor(qry); } cr1be = reply+1; for(int i = 0; i<h+w-k-1; i++) { reply = add_and({NWd+i, NWd+i+k}); } for(int i = 0; i<h+w-k-1; i++) { reply = add_and({NEd+i, NEd+i+k}); } cr1en = reply; qry.clear(); for(int i = cr1be; i<=cr1en; i++) { qry.push_back(i); } assert(!qry.empty()); cr1 = add_or(qry); }

Compilation message (stderr)

vision.cpp: In function 'void opt(std::vector<int>)':
vision.cpp:21:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for(int i = 0; i<qry.size(); i++)
      |                 ~^~~~~~~~~~~
vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:33:65: warning: variable 'cr1' set but not used [-Wunused-but-set-variable]
   33 |  int row, col, reply, NWd = h*w, NEd = h*w+h+w-1, cr1be, cr1en, cr1;
      |                                                                 ^~~
vision.cpp:65:8: warning: 'reply' may be used uninitialized in this function [-Wmaybe-uninitialized]
   65 |  cr1be = reply+1;
      |  ~~~~~~^~~~~~~~~
#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...