Submission #1027860

#TimeUsernameProblemLanguageResultExecution timeMemory
10278600npataVision Program (IOI19_vision)C++17
44 / 100
1044 ms2980 KiB
#include "vision.h" #include<bits/stdc++.h> using namespace std; #define vec vector void construct_network(int H, int W, int K) { //cerr << H << ' ' << W << ' ' << K << '\n'; auto dist = [&](int i, int j) { int x1 = i%W; int y1 = i/W; int x2 = j%W; int y2 = j/W; return abs(x1-x2)+abs(y1-y2); }; vec<int> cand(0); vec<pair<int, int>> extra(0); for(int i = 0; i<H*W; i++) { vec<int> xor_check(0); for(int j = i+1; j<H*W; j++) { if(dist(i, j) == K) { xor_check.push_back(j); // cerr << "HERE" << '\n'; } } if(xor_check.size() > 1) { add_xor(xor_check); cand.push_back(i); } else if(xor_check.size() == 1) { extra.push_back({i, xor_check[0]}); } } for(int i = 0; i<cand.size(); i++) { add_and({cand[i], i+H*W}); } for(auto [x, y] : extra) { add_and({x, y}); } // cerr << "OK" << '\n'; vec<int> or_check(cand.size()+extra.size()); // cerr << cnt << '\n'; iota(or_check.begin(), or_check.end(), H*W+cand.size()); add_or(or_check); }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:38:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |  for(int i = 0; i<cand.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...