# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
970249 | 2024-04-26T09:28:05 Z | CSQ31 | 전선 연결 (IOI17_wiring) | C++17 | 29 ms | 6948 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][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 | 1 ms | 348 KB | 3rd lines differ - on the 1st token, expected: '25859', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 20 ms | 5324 KB | Output is correct |
4 | Correct | 20 ms | 5160 KB | Output is correct |
5 | Correct | 20 ms | 5408 KB | Output is correct |
6 | Correct | 27 ms | 6916 KB | Output is correct |
7 | Correct | 29 ms | 6948 KB | Output is correct |
8 | Correct | 27 ms | 6852 KB | Output is correct |
9 | Correct | 26 ms | 6852 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Incorrect | 1 ms | 428 KB | 3rd lines differ - on the 1st token, expected: '17703', found: '0' |
3 | 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 | 1 ms | 348 KB | 3rd lines differ - on the 1st token, expected: '25859', found: '0' |
2 | Halted | 0 ms | 0 KB | - |