Submission #555016

#TimeUsernameProblemLanguageResultExecution timeMemory
555016slimeVision Program (IOI19_vision)C++14
0 / 100
5 ms1204 KiB
#include <bits/stdc++.h> #include "vision.h" #include <map> void construct_network(int H, int W, int K) { std::vector<int> Ns; std::vector<int> by_sum, by_diff; std::map<int, std::vector<int> > mp_sum, mp_diff; for(int i=0; i<H; i++) { for(int j=0; j<W; j++) { mp_sum[i + j].push_back(i*W + j); mp_diff[i - j].push_back(i*W + j); } } std::vector<int> analyze; // Necessary conditions, i.e. AND clause for(auto x: mp_sum) { by_sum.push_back(add_or(x.second)); } for(auto x: mp_diff) { by_diff.push_back(add_or(x.second)); } // Condition 1: at least one of these two arrays' 1s are exactly K cells apart std::vector<int> cond1; for(int i=0; i<by_sum.size(); i++) { if(i + K < by_sum.size()) { std::vector<int> uwu = {by_sum[i], by_sum[i + K]}; cond1.push_back(add_and(uwu)); } } for(int i=0; i<by_diff.size(); i++) { if(i + K < by_diff.size()) { std::vector<int> uwu = {by_diff[i], by_diff[i + K]}; cond1.push_back(add_and(uwu)); } } /* // Only one in cond1 array = 1 is necessary (but at least 1)! analyze.push_back(add_or(cond1)); // condition 2: [1 + K 0s] should not appear in any of them std::vector<int> cond2; for(int i=0; i<by_sum.size(); i++) { if(i + 1 + K < by_sum.size()) { std::vector<int> patt; // does this subarray match the pattern? std::vector<int> uwu = {by_sum[i]}; patt.push_back(add_and(uwu)); uwu.clear(); for(int j=i+1; j<i+1+K; j++) uwu.push_back(by_sum[j]); patt.push_back(add_not(add_or(uwu))); // Everything in patt = 1 iff by_sum[i] = 1 and all by_sum[i+1] to by_sum[i+K] = 0 cond2.push_back(add_and(patt)); // = 1 if match pattern, = 0 otherwise } } //analyze.push_back(add_not(add_or(cond2))); // = 1 if all cond2 = 0, i.e. no pattern found */ add_and(analyze); // answer }

Compilation message (stderr)

vision.cpp: In function 'void construct_network(int, int, int)':
vision.cpp:24:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |   for(int i=0; i<by_sum.size(); i++) {
      |                ~^~~~~~~~~~~~~~
vision.cpp:25:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     if(i + K < by_sum.size()) {
      |        ~~~~~~^~~~~~~~~~~~~~~
vision.cpp:30:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |   for(int i=0; i<by_diff.size(); i++) {
      |                ~^~~~~~~~~~~~~~~
vision.cpp:31:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     if(i + K < by_diff.size()) {
      |        ~~~~~~^~~~~~~~~~~~~~~~
#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...