| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1154515 | Math4Life2020 | Island Hopping (JOI24_island) | C++20 | 3 ms | 412 KiB |
#include "island.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using pii = pair<ll,ll>;
const ll Nm = 305;
ll f[Nm];
ll getf(ll x) {
if (f[x]==x) {
return x;
}
return f[x]=getf(f[x]);
}
void fz(ll a, ll b) {
a = getf(a); b = getf(b);
if (a!=b) {
f[a]=b;
}
}
void solve(int N, int L) {
for (ll i=0;i<N;i++) {
f[i]=i;
}
vector<bool> frz(N,0); //frozen?
for (ll T=0;T<(N-1);T++) {
for (ll i=(N-1);i>=0;i--) {
if (!frz[i]) {
ll jc = query(i+1,T+1)-1;
if (jc>i || getf(jc)==getf(i)) {
frz[i]=1;
} else {
answer(jc+1,i+1);
fz(jc,i);
}
}
}
}
}| # | 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... | ||||
