Submission #964248

#TimeUsernameProblemLanguageResultExecution timeMemory
964248PenguinsAreCuteWiring (IOI17_wiring)C++17
13 / 100
27 ms3932 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; using ll = long long; int detNear(int x, vector<int> &r) { int hi = lower_bound(r.begin(),r.end(),x)-r.begin(); if(hi==r.size()) hi--; if(hi && x-r[hi-1]<r[hi]-x) return hi-1; else return hi; } long long min_total_length(std::vector<int> r, std::vector<int> b) { if(r.size()<b.size()) swap(r,b); int n = r.size(), m = b.size(); ll ans = 0; for(int i=0;i<n;i++) { int meow = detNear(r[i],b); meow=max(min(meow,i),m-n+i); ans += abs(b[meow] - r[i]); } return ans; }

Compilation message (stderr)

wiring.cpp: In function 'int detNear(int, std::vector<int>&)':
wiring.cpp:7:7: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |  if(hi==r.size()) hi--;
      |     ~~^~~~~~~~~~
#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...