# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
56767 | win11905 | Teleporters (IOI08_teleporters) | C++11 | 795 ms | 66560 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pii pair<int, int>
#define x first
#define y second
using namespace std;
const int N = 2e6+5;
int n, m, psz, pz1;
bool Check[N];
int main() {
vector<int> V(N), val(N), neibour(N), Com(N);
scanf("%d %d", &n, &m);
for(int i = 0, u, v; i < n; ++i) {
scanf("%d %d", &u, &v);
neibour[u] = v, neibour[v] = u;
V[u]++, V[v]++;
}
for(int i = 1; i < N; ++i) {
V[i] += V[i-1];
if(V[i] != V[i-1]) Com[pz1++] = i;
}
int cnt = 0, p = 0; Check[0] = true;
while(p != (n<<1)) Check[p = V[neibour[Com[p]]]] = true, cnt++;
for(int i = 1; i <= (n<<1); ++i) if(!Check[i]) {
int u = i, sz = 0; Check[u] = true;
do Check[u = V[neibour[Com[u]]]] = true, sz++; while(u != i);
val[++psz] = sz;
}
sort(val.begin()+1, val.begin() + psz + 1, greater<int>()); for(int i = 1; i <= psz; ++i) val[i] += val[i-1];
cnt += val[min(psz, m)] + 2 * min(psz, m);
if(m > psz) m -= psz, cnt += ((m>>1)<<2) + (m & 1);
printf("%d\n", cnt);
}
컴파일 시 표준 에러 (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... |
# | 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... |
# | 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... |
# | 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... |