답안 #426073

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
426073 2021-06-13T13:40:14 Z ioi 전선 연결 (IOI17_wiring) C++14
13 / 100
31 ms 3760 KB
#include "wiring.h"
#include<bits/stdc++.h>
using namespace std ;


long long min_total_length(std::vector<int> r, std::vector<int> b) {

    long long ret = 0 ;

    if(r.size() > b.size()){
        int p = r.size() - 1 ;

        for(int i = b.size() - 1 ; i >= 0 ; i --)
            ret += b[i] - r[p--];
     
        int R = r.size() , B = b.size();
        for(int i = R - B - 1 ; i >= 0 ; i --)
            ret += b[0] - r[i];


    }
    else {

        int p1 = r.size() , p2 = b.size() ;

        while(p1 > -1 && p2 > -1){

            ret += b[p2] - r[p1];
            p2 -- , p1 -- ;


        }
        long long sum = 0 ;

        while(p2 > -1){
            sum += b[p2--];
        }
        ret += (sum - (b.size() - r.size()) * r.back()) ;

    }
	return ret;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '25859', found: '-4909'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 30 ms 2920 KB Output is correct
4 Correct 28 ms 2784 KB Output is correct
5 Correct 28 ms 2884 KB Output is correct
6 Correct 31 ms 3740 KB Output is correct
7 Correct 31 ms 3752 KB Output is correct
8 Correct 29 ms 3760 KB Output is correct
9 Correct 30 ms 3744 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '316', found: '-58836'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 288 KB 3rd lines differ - on the 1st token, expected: '27', found: '-59108'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB 3rd lines differ - on the 1st token, expected: '25859', found: '-4909'
2 Halted 0 ms 0 KB -