# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
970248 | 2024-04-26T09:27:07 Z | CSQ31 | 전선 연결 (IOI17_wiring) | C++17 | 1 ms | 348 KB |
#include "wiring.h" #include <bits/stdc++.h> using namespace std; typedef long long int ll; ll min_total_length(vector<int> R,vector<int> B) { vector<array<int,2>>a; for(int x:R)a.push_back({x,0}); for(int x:B)a.push_back({x,1}); sort(a.begin(),a.end()); vector<vector<int>>b; int n = a.size(); for(int i=0;i<n;i++){ int j = i; b.push_back({a[i][0]}); while(j+1<n && a[j][1] == a[j+1][1]){ j++; b.back().push_back(a[j+1][0]); } i = j; } if(b.size() == 2){ ll ans = 0; for(int i=0;i<b[0].size();i++)ans += b[0].back() - b[0][i]; for(int i=0;i<b[1].size();i++)ans += b[1][i] - b[1][0]; int mx = max(b[0].size(),b[1].size()); ans += mx * 1LL * (b[1][0] - b[0].back()); return ans; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 3rd lines differ - on the 1st token, expected: '25859', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 3rd lines differ - on the 1st token, expected: '904', found: '791' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | 3rd lines differ - on the 1st token, expected: '316', found: '216' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 3rd lines differ - on the 1st token, expected: '27', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | 3rd lines differ - on the 1st token, expected: '25859', found: '0' |
2 | Halted | 0 ms | 0 KB | - |