답안 #964248

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
964248 2024-04-16T13:30:52 Z PenguinsAreCute 전선 연결 (IOI17_wiring) C++17
13 / 100
27 ms 3932 KB
#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

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--;
      |     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB 3rd lines differ - on the 1st token, expected: '25859', found: '25753'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 21 ms 2908 KB Output is correct
4 Correct 16 ms 2904 KB Output is correct
5 Correct 23 ms 2940 KB Output is correct
6 Correct 27 ms 3896 KB Output is correct
7 Correct 22 ms 3900 KB Output is correct
8 Correct 21 ms 3776 KB Output is correct
9 Correct 21 ms 3932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Incorrect 0 ms 348 KB 3rd lines differ - on the 1st token, expected: '17703', found: '19052'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB 3rd lines differ - on the 1st token, expected: '27', found: '30'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB 3rd lines differ - on the 1st token, expected: '25859', found: '25753'
2 Halted 0 ms 0 KB -