답안 #738386

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
738386 2023-05-08T15:46:44 Z Elvin_Fritl 전선 연결 (IOI17_wiring) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;
#include "wiring.h"

long long min_total_length(vector<int> r, vector<int> b){
    set<int>s;
    for(int i=0;i<(int)r.size();i++){
        s.insert(r[i]);
    }
    
    long long res=0;
    
    for(int i=0;i<(int)b.size();i++){
        auto it=s.upper_bound(b[i]);
        auto it2=it;
        if(it!=s.begin()){
            it2--;
        }
        int tmp=min(abs(*it - b[i]) , abs(*it2 - b[i]));
        res+=tmp;
    }
    
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB 3rd lines differ - on the 1st token, expected: '25859', found: '20223'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '904', found: '326'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '316', found: '188'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '27', found: '16'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB 3rd lines differ - on the 1st token, expected: '25859', found: '20223'
2 Halted 0 ms 0 KB -