Submission #307720

#TimeUsernameProblemLanguageResultExecution timeMemory
307720urd05Finding Routers (IOI20_routers)C++14
100 / 100
3 ms512 KiB
#include "routers.h" #include <bits/stdc++.h> using namespace std; vector<int> v[1000]; int func(int x) { int ret=use_detector(x); v[ret].push_back(x); return ret; } vector<int> find_routers(int l, int n, int q) { vector<int> ret(n); int st=0; vector<int> cut; for(int i=0;i<n-1;i++) { int lo=st; int hi=l; for(int j=0;j<v[i].size();j++) { lo=max(lo,v[i][j]); } for(int j=i+1;j<n;j++) { for(int k=0;k<v[j].size();k++) { hi=min(hi,v[j][k]); } } while (lo+1<hi) { int mid=(lo+hi)/2; if (func(mid)==i) { lo=mid; } else { hi=mid; } } cut.push_back(lo); st=hi; } ret[0]=0; for(int i=1;i<n;i++) { ret[i]=cut[i-1]+cut[i-1]-ret[i-1]; } return ret; }

Compilation message (stderr)

routers.cpp: In function 'std::vector<int> find_routers(int, int, int)':
routers.cpp:20:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |         for(int j=0;j<v[i].size();j++) {
      |                     ~^~~~~~~~~~~~
routers.cpp:24:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |             for(int k=0;k<v[j].size();k++) {
      |                         ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...