Submission #618195

#TimeUsernameProblemLanguageResultExecution timeMemory
618195joelauVision Program (IOI19_vision)C++14
52 / 100
4 ms596 KiB
#include "vision.h" #include <bits/stdc++.h> using namespace std; void construct_network(int H, int W, int K) { if (max(H,W) <= 30 || min(H,W) == 1) { vector<int> A; for (int i = 0; i < H; ++i) for (int j = 0; j < W; ++j) { vector<int> V; if (i+K < H) V.push_back((i+K)*W+j); if (i-K >= 0) V.push_back((i-K)*W+j); if (j+K < W) V.push_back(i*W+j+K); if (j-K >= 0) V.push_back(i*W+j-K); for (int x = 1; x < K; ++x) { int y = K-x; if (i+x < H && j+y < W) V.push_back((i+x)*W+j+y); if (i+x < H && j-y >= 0) V.push_back((i+x)*W+j-y); if (i-x >= 0 && j+y < W) V.push_back((i-x)*W+j+y); if (i-x >= 0 && j-y >= 0) V.push_back((i-x)*W+j-y); } if (!V.empty()) { add_or(V); A.push_back(i*W+j); } } for (int i = 0; i < A.size(); ++i) add_and({A[i],H*W+i}); vector<int> V; for (int i = 0; i < A.size(); ++i) V.push_back(H*W+A.size()+i); add_or(V); } else { vector<int> V; for (int x = 0; x <= K; ++x) { int y = K-x; if (x < H && y < W) V.push_back(x*W+y); } add_or(V); } }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:26:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   for (int i = 0; i < A.size(); ++i) add_and({A[i],H*W+i});
      |                   ~~^~~~~~~~~~
vision.cpp:28:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |   for (int i = 0; i < A.size(); ++i) V.push_back(H*W+A.size()+i);
      |                   ~~^~~~~~~~~~
#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...