| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 980749 | TheEpicCowOfLife | Island Hopping (JOI24_island) | C++17 | 8 ms | 1456 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "island.h"
using namespace std;
int N;
vector<int> g[305];
int d[305][305];
int ua[305];
vector<int> ug[305];
void dfs(int x, int par, int root, int depth){
d[root][x] = depth;
d[x][root] = depth;
for (int tgt : g[x]){
if (tgt == par) continue;
dfs(tgt,x,root,depth+1);
}
}
int f(int x){
if (ua[x] == x) return x;
return ua[x] = f(ua[x]);
}
// "All neighbours known"
bool ann[305];
int gi[305];
void merge(int x, int y){
int fx = f(x);
int fy = f(y);
if (f(x) == f(y)){
return;
}
if (ug[fx].size() > ug[fy].size()){
swap(fx,fy);
swap(x,y);
}
g[x].push_back(y);
g[y].push_back(x);
answer(x,y);
if (g[x].size() == N-1){
ann[x] = true;
}
if (g[y].size() == N-1){
ann[y] = true;
}
for (int tgt : ug[fx]){
ug[fy].push_back(tgt);
dfs(tgt,-1,tgt,0);
}
ua[fx] = fy;
ug[fx].clear();
}
void solve(int n, int L) {
N = n;
for (int i = 1; i <= N; i++){
ug[i].push_back(i);
ua[i] = i;
gi[i] = 1;
}
for (int i = N; i > 1; i--){
int ret = query(i,1);
merge(i,ret);
}
ann[1] = true;
for (int cur_ann = 1; cur_ann < N; cur_ann++){
for (int i = 1; i <= cur_ann; i++){
for (int j: g[i]){
if (ann[j]) continue;
bool can_expand = true;
for (int tgt: g[j]){
if (!ann[tgt]) {
can_expand = false;
break;
}
}
if (can_expand){
int ret = query(j,++gi[j]);
if (d[ret][j] == 2){
ann[j] = true;
}
else{
merge(ret,j);
}
}
}
}
ann[cur_ann+1] = true;
}
// int variable_example = query(1, 1);
// for (int i = 2; i <= N; i++) {
// answer(1, i);
// }
}컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
