# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
42337 | milmillin | Poklon (COCI17_poklon7) | C++14 | 337 ms | 120396 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
long long l[1000100];
long long r[1000100];
long long getWgt(int idx) {
if (idx<0) return -idx;
return max(getWgt(l[idx]),getWgt(r[idx]))*2;
}
int main () {
int n;
scanf("%d",&n);
for (int i=1;i<=n;i++) {
scanf("%lld%lld",&l[i],&r[i]);
}
long long ans=getWgt(1);
//printf("%lld\n",ans);
string x;
while (ans) {
if (ans%2) x.push_back('1');
else x.push_back('0');
ans/=2;
}
reverse(x.begin(),x.end());
cout << x << '\n';
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |