| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 405190 | Aryan_Raina | Poklon (COCI17_poklon7) | C++14 | 335 ms | 111564 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define int int64_t
#define ld long double
#define ar array
const int INF = 1e17;
const int MOD = 1e9+7;
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int N; cin >> N;
vector<ar<int,2>> adj(N);
for (auto &i : adj) {
cin >> i[0] >> i[1];
if (i[0] > 0) --i[0];
if (i[1] > 0) --i[1];
}
int ans = 0;
function<void(int, int)> dfs = [&](int u, int depth) {
int lc = adj[u][0], rc = adj[u][1];
if (lc < 0) ans = max(-lc * (1 << depth), ans);
else dfs(lc, depth + 1);
if (rc < 0) ans = max(-rc * (1 << depth), ans);
else dfs(rc, depth + 1);
};
dfs(0, 1);
vector<int> remdi;
while (ans) { remdi.push_back(ans & 1); ans >>= 1; }
reverse(remdi.begin(), remdi.end());
for (int i : remdi) cout << i;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
