Submission #1303838

#TimeUsernameProblemLanguageResultExecution timeMemory
1303838SabaKharebava이주 (IOI25_migrations)C++20
0 / 100
28 ms480 KiB
#include<bits/stdc++.h> using namespace std; #define pb push_back vector<int> st; void to_binary(int num) { for (int i = 0; i < 13; i++) { if (num&1) st.pb(1); else st.pb(0); num >>= 1; } } int from_binary(vector<int> v) { int num = 0; for (int e : v) { num <<= 1; num += e; } return num; } vector<int> depth(10001, 0); int mxv = 0; int send_message(int N, int i, int Pi) { depth[i] = depth[Pi]+1; if (i < N-14) { if (depth[i] > depth[mxv]) mxv = i; return 0; } if (i == N-14) { if (depth[i] > depth[mxv]) mxv = i; st.clear(); to_binary(mxv); return 0; } else if (i > N-14) { if (depth[i] > depth[mxv]) { mxv = i; return 2; } } int tp = st.back(); st.pop_back(); return tp; } pair<int, int> longest_path(std::vector<int> S) { for (int i = S.size()-1; i >= S.size()-13; i--) if (S[i] == 2) return make_pair(0, i); vector<int> v; for (int i = S.size()-13; i < S.size(); i++) v.pb(S[i]); return make_pair(0, from_binary(v)); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...