# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
895657 | Andrey | 전선 연결 (IOI17_wiring) | C++14 | 21 ms | 3648 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "wiring.h"
#include<bits/stdc++.h>
using namespace std;
long long min_total_length(std::vector<int> r, std::vector<int> b) {
int n = r.size(),m = b.size();
vector<int> haha(n+m+1);
for(int i = 0; i < n; i++) {
haha[r[i]] = 1;
}
vector<int> bruh(0);
int p = 0;
for(int i = 1; i <= n+m; i++) {
if(i == 1 || haha[i] == haha[i-1]) {
p++;
}
else {
bruh.push_back(p);
p = 1;
}
}
bruh.push_back(p);
vector<long long> ans(0);
ans.push_back(bruh[0]);
for(int i = 1; i < bruh.size()-1; i++) {
if(bruh[i]/2 == ans[ans.size()-1] && (bruh[i]+1)/2 > ans[ans.size()-1]) {
ans.push_back(bruh[i]/2);
ans.push_back(bruh[i]/2+1);
}
else {
ans.push_back((bruh[i]+1)/2);
ans.push_back(bruh[i]/2);
}
}
ans.push_back(bruh[bruh.size()-1]);
long long sb = 0;
for(int i = 0; i < ans.size(); i++) {
sb+=(ans[i]-1)*ans[i]/2;
}
for(int i = 0; i < ans.size(); i+=2) {
sb+=max(ans[i],ans[i+1]);
}
return sb;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |