Submission #208289

#TimeUsernameProblemLanguageResultExecution timeMemory
208289a_playerWiring (IOI17_wiring)C++14
0 / 100
5 ms376 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; const int MAXN=1e5+5; typedef long long ll; bitset<MAXN> vb; long long min_total_length(std::vector<int> r, std::vector<int> b) { ll ans=0; for(int x:r){ ll mini=LLONG_MAX; int p=upper_bound(b.begin(),b.end(),x)-b.begin(); if(p!=0)mini=(ll)(x-b[p-1]),vb[p-1]=1; if(p!=b.size()&&(ll)(b[p]-x)<mini)mini=(ll)(b[p]-x),vb[p]=1; ans+=mini; } for(int i=0;i<b.size();i++){ if(vb[i])continue; ll mini=LLONG_MAX; int p=upper_bound(r.begin(),r.end(),b[i])-r.begin(); if(p!=0)mini=(ll)(b[i]-r[p-1]); if(p!=r.size()&&(ll)(r[p]-b[i])<mini)mini=(ll)(r[p]-b[i]); ans+=mini; } return ans; }

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:18:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(p!=b.size()&&(ll)(b[p]-x)<mini)mini=(ll)(b[p]-x),vb[p]=1;
            ~^~~~~~~~~~
wiring.cpp:21:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<b.size();i++){
                 ~^~~~~~~~~
wiring.cpp:26:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if(p!=r.size()&&(ll)(r[p]-b[i])<mini)mini=(ll)(r[p]-b[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...