제출 #208287

#제출 시각아이디문제언어결과실행 시간메모리
208287a_player전선 연결 (IOI17_wiring)C++14
0 / 100
5 ms376 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; const int MAXN=1e5+5; bitset<MAXN> vb; long long min_total_length(std::vector<int> r, std::vector<int> b) { int ans=0; for(int x:r){ int mini=INT_MAX; int p=upper_bound(b.begin(),b.end(),x)-b.begin(); if(p!=0)mini=x-b[p-1],vb[p-1]=1; if(p!=b.size()&&b[p]-x<mini)mini=b[p]-x,vb[p]=1; ans+=mini; } for(int i=0;i<b.size();i++){ if(vb[i])continue; int mini=INT_MAX; int p=upper_bound(r.begin(),r.end(),b[i])-r.begin(); if(p!=0)mini=b[i]-r[p-1]; if(p!=r.size()&&r[p]-b[i]<mini)mini=r[p]-b[i]; ans+=mini; } return ans; }

컴파일 시 표준 에러 (stderr) 메시지

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