Submission #73223

#TimeUsernameProblemLanguageResultExecution timeMemory
73223nvmdava전선 연결 (IOI17_wiring)C++17
0 / 100
3 ms536 KiB
#include "wiring.h" #include <bits/stdc++.h> using namespace std; int a[200001]; long long min_total_length(std::vector<int> r, std::vector<int> b) { if(r.back() < b.back()){ swap(r, b); } a[0] = 0; a[b.size()] = r.size(); long long ans = 0; for(int i = 1; i < b.size(); i++){ a[i] = upper_bound(r.begin(), r.end(), (b[i] + b[i - 1]) / 2) - r.begin(); if(a[i] <= a[i - 1]) a[i] = a[i - 1] + 1; } for(int i = 0; i < b.size(); i++){ for(int j = a[i]; j < a[i + 1]; j++){ ans += (long long) abs(r[j] - b[i]); } } return ans; }

Compilation message (stderr)

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