Submission #192706

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1927062020-01-15 06:57:49imeimi2000Dancing Elephants (IOI11_elephants)C++17
100 / 100
1704 ms28344 KiB
#include <bits/stdc++.h>
#define fs first
#define se second
using namespace std;
typedef pair<int, int> pii;
const int inf = 1e9 + 1;
const int rinf = inf + inf;
const int linf = -1;
int n, l;
namespace LCT {
struct node {
int L, R, P;
int cnt, sum;
} ns[300010];
void set_cnt(int x, int v) {
ns[x].cnt = ns[x].sum = v;
}
void update(int x) {
ns[x].sum = ns[x].cnt;
if (ns[x].L) ns[x].sum += ns[ns[x].L].sum;
if (ns[x].R) ns[x].sum += ns[ns[x].R].sum;
}
bool is_root(int x) {
return ns[x].P == 0 || ns[ns[x].P].L != x && ns[ns[x].P].R != x;
}
void rotate(int x) {
int p = ns[x].P;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

elephants.cpp: In function 'bool LCT::is_root(int)':
elephants.cpp:27:51: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
         return ns[x].P == 0 || ns[ns[x].P].L != x && ns[ns[x].P].R != x;
                                ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...