# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
89373 |
2018-12-12T15:53:12 Z |
vex |
Poklon (COCI17_poklon7) |
C++14 |
|
291 ms |
39740 KB |
#include <bits/stdc++.h>
#define maxn 1000005
using namespace std;
int n;
int l[maxn];
int r[maxn];
long long resi(int x)
{
long long sol;
if(l[x]>0)sol=resi(l[x]);else sol=-l[x];
if(r[x]>0)sol=max(sol,resi(r[x]));else sol=max(sol,(long long)(-r[x]));
return 2*sol;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>l[i]>>r[i];
}
long long sol=resi(1);
string s;
while(sol>0)
{
s.push_back(sol%2 + '0');
sol/=2;
}
int len=s.size();
for(int i=len-1;i>=0;i--)cout<<s[i];
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
452 KB |
Output is correct |
3 |
Correct |
2 ms |
452 KB |
Output is correct |
4 |
Correct |
2 ms |
460 KB |
Output is correct |
5 |
Correct |
2 ms |
604 KB |
Output is correct |
6 |
Correct |
2 ms |
604 KB |
Output is correct |
7 |
Correct |
2 ms |
604 KB |
Output is correct |
8 |
Correct |
2 ms |
676 KB |
Output is correct |
9 |
Incorrect |
2 ms |
676 KB |
Output isn't correct |
10 |
Incorrect |
2 ms |
676 KB |
Output isn't correct |
11 |
Incorrect |
5 ms |
696 KB |
Output isn't correct |
12 |
Incorrect |
5 ms |
696 KB |
Output isn't correct |
13 |
Incorrect |
17 ms |
1688 KB |
Output isn't correct |
14 |
Incorrect |
30 ms |
3000 KB |
Output isn't correct |
15 |
Incorrect |
30 ms |
3000 KB |
Output isn't correct |
16 |
Incorrect |
100 ms |
7108 KB |
Output isn't correct |
17 |
Incorrect |
233 ms |
14836 KB |
Output isn't correct |
18 |
Incorrect |
234 ms |
16348 KB |
Output isn't correct |
19 |
Incorrect |
291 ms |
16348 KB |
Output isn't correct |
20 |
Incorrect |
281 ms |
39740 KB |
Output isn't correct |