# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
168167 |
2019-12-11T17:48:03 Z |
sans |
Poklon (COCI17_poklon7) |
C++14 |
|
621 ms |
262144 KB |
#include <iostream>
#include <numeric>
#include <cmath>
#include <algorithm>
#include <vector>
#include <stack>
using namespace std;
#define sp ' '
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define forn(YY, yy) for(long long int yy = 0; yy < YY; ++yy)
#define prn(XX) cout << XX << endl
#define prs(XX) cout << XX << " "
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
const int MOD = 1e9 + 7;
const int INF = 2e9 + 13;
const int mINF = -2e9 - 13;
const double PI = 3.14159265358979;
const double EPS = 1e-9;
struct Scale{
ll left;
ll right;
};
vector<Scale> sc;
vector<ll> tree;
vector<vector<ll>> AdjList;
ll maxy = 0;
ll build(ll n, ll node, ll depth){
if(sc[n].left > 0) tree[2*node+1] = build(sc[n].left, 2*node+1, depth+1);
else{ tree[2*node+1] = -sc[n].left; maxy = max(maxy, (1 << depth)*tree[2*node+1]); }
if(sc[n].right > 0) tree[2*node+2] = build(sc[n].right, 2*node+2, depth+1);
else{ tree[2*node+2] = -sc[n].right; maxy = max(maxy, (1 << depth)*tree[2*node+2]); }
return tree[node] = tree[2*node+1] + tree[2*node+2];
}
int main(int argc, char **argv){
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
ll N;
cin >> N;
sc.resize(N);
tree.resize(6*N, -1);
for(int i = 0; i < N; ++i){ cin >> sc[i].left >> sc[i].right; if(sc[i].left > 0) --sc[i].left; if(sc[i].right > 0) --sc[i].right; }
build(0, 0, 1);
stack<int> bin;
while(maxy){
bin.push(maxy%2);
maxy >>= 1;
}
while(!bin.empty()){
int top = bin.top();
cout << top;
bin.pop();
}
cout << endl;
return 0;
}
//cikisir
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Runtime error |
2 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
5 |
Runtime error |
2 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
6 |
Runtime error |
2 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
7 |
Runtime error |
2 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
8 |
Runtime error |
3 ms |
504 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
9 |
Runtime error |
3 ms |
512 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
10 |
Runtime error |
3 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
11 |
Runtime error |
6 ms |
1912 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
12 |
Runtime error |
7 ms |
2352 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
13 |
Runtime error |
22 ms |
7800 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
14 |
Runtime error |
42 ms |
14636 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
15 |
Runtime error |
42 ms |
14840 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
16 |
Runtime error |
149 ms |
49144 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
17 |
Runtime error |
348 ms |
114860 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
18 |
Runtime error |
328 ms |
115956 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
19 |
Runtime error |
435 ms |
144936 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
20 |
Runtime error |
621 ms |
262144 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |