Submission #43357

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
433572018-03-14 14:34:10szawinisSynchronization (JOI13_synchronization)C++14
100 / 100
282 ms73156 KiB
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define repi(i, a, b) for(int i = a; i <= b; i++)
#define drep(i, a, b) for(int i = a; i >= b; i--)
using namespace std;
const int N = 1 << 18;
int n, m, q, u[N], v[N], d[N], s[N], e[N], ord[N], res[N], last[N];
bool state[N];
vector<int> g[N];
void dfs(int u, int p) {
static int idx = 0;
s[u] = ++idx;
ord[s[u]] = u;
for(int v: g[u]) if(v != p) d[v] = d[u] + 1, dfs(v, u);
e[u] = idx;
}
int t[2*N];
void build(int i = 1, int l = 0, int r = N-1) {
if(l == r) {
t[i] = e[ord[l]];
return;
}
int mid = l+r >> 1;
build(i<<1, l, mid);
build(i<<1|1, mid+1, r);
t[i] = max(t[i<<1], t[i<<1|1]);
}
void update(int targ, int val, int i = 1, int l = 0, int r = N-1) {
if(l == r) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

synchronization.cpp: In function 'void build(int, int, int)':
synchronization.cpp:24:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  int mid = l+r >> 1;
             ^
synchronization.cpp: In function 'void update(int, int, int, int, int)':
synchronization.cpp:34:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  int mid = l+r >> 1;
             ^
synchronization.cpp: In function 'int get_root(int, int, int, int, int)':
synchronization.cpp:42:13: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
  int mid = l+r >> 1, ret = get_root(tl, tr, i<<1|1, mid+1, r);
             ^
synchronization.cpp: In function 'int main()':
synchronization.cpp:47:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d %d", &n, &m, &q);
                               ^
synchronization.cpp:49:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", u+i, v+i);
                           ^
synchronization.cpp:57:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int i; scanf("%d", &i);
                         ^
synchronization.cpp:71:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int vert; scanf("%d", &vert);
                               ^
#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...