Submission #403204

#TimeUsernameProblemLanguageResultExecution timeMemory
403204iraira655Finding Routers (IOI20_routers)C++17
16 / 100
4 ms280 KiB
#include "routers.h" using namespace std; vector<int> find_routers(int l, int n, int q) { vector<int> ans; ans.push_back(0); int prev = 0, c = 0, prevPos = 0; for(int i=1; i<=l; i++){ int next = use_detector(i); c++; if(next!=prev){ prev = next; prevPos = 2*(c-1) ; ans.push_back(prevPos); c = 1; if(ans.size() == n) break; } } return ans; }

Compilation message (stderr)

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:17:21: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   17 |       if(ans.size() == n) break;
      |          ~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...