답안 #640168

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
640168 2022-09-13T18:55:59 Z trunghieu 전선 연결 (IOI17_wiring) C++14
0 / 100
20 ms 2936 KB
#include "wiring.h"
//#include "grader.cpp"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 205;
const ll oo = 1e18;
bool mark[N];
long long min_total_length(std::vector<int> r, std::vector<int> b) {
    int n = r.size();
    int m = b.size();
    if (n < m) {
        swap(n, m);
        swap(r, b);
    }
    ll rs = 0;
    for (int i = 0; i < m; ++i) {
        ll Min = oo;
        int pos = -1;
        for (int j = 0; j < n; ++j) if (!mark[j]) {
            if (abs(r[j] - b[i]) < Min) {
                Min = abs(r[j] - b[i]);
                pos = j;
            }
        }
        mark[pos] = 1;
        rs += Min;
    }
    for (int i = 0; i < n; ++i) if (!mark[i]) {
        ll Min = oo;
        for (int j = 0; j < m; ++j) Min = min(Min, (ll)abs(r[i] - b[j]));
        rs += Min;
    }
	return rs;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '25859', found: '26205'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Runtime error 20 ms 2936 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '17703', found: '19052'
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '27', found: '60'
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB 3rd lines differ - on the 1st token, expected: '25859', found: '26205'
2 Halted 0 ms 0 KB -