Submission #384937

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3849372021-04-02 17:13:48arman_ferdousMechanical Doll (IOI18_doll)C++17
37 / 100
134 ms11820 KiB
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
#define sz(v) (int)v.size()
const int M = (1 << 19);
int x[M], y[M], cnt[M], maxSwitch;
void build(int u, int L, int R) {
maxSwitch = max(maxSwitch, u);
cnt[u] = 0;
if(L == R) return;
int mid = L + R >> 1, lc = u << 1, rc = lc | 1;
x[u] = lc, y[u] = rc;
build(lc, L, mid); build(rc, mid + 1, R);
}
void insert(int u, int L, int R, int nxt) {
if(L == R) {
if(~cnt[u] & 1) x[u] = -nxt;
else y[u] = -nxt;
cnt[u] ^= 1;
return;
} int mid = L + R >> 1, lc = u << 1, rc = lc | 1;
if(~cnt[u] & 1) {
cnt[u] ^= 1;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

doll.cpp: In function 'void build(int, int, int)':
doll.cpp:16:15: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   16 |   int mid = L + R >> 1, lc = u << 1, rc = lc | 1;
      |             ~~^~~
doll.cpp: In function 'void insert(int, int, int, int)':
doll.cpp:27:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   27 |   } int mid = L + R >> 1, lc = u << 1, rc = lc | 1;
      |               ~~^~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...