Submission #683881

# Submission time Handle Problem Language Result Execution time Memory
683881 2023-01-19T14:26:00 Z amukkalir Secret (JOI14_secret) C++17
0 / 100
458 ms 4508 KB
#include "secret.h"
#include <bits/stdc++.h>
using namespace std; 

const int nax = 1e3;
int tree[2][4*nax+5];
int a[nax+5]; 
int n; 
void build(int x, int l=0, int r=n-1, int idx=1){
  if (l == r) {
    tree[x][idx] = a[l+x]; 
  } else {
    int m = (l+r)>>1; 
    build(x,l,m,idx<<1);
    build(x,m+1,r,idx<<1|1); 
    tree[x][idx] = Secret(tree[x][idx<<1], tree[x][idx<<1|1]); 
  }
}

int get(int x, int fr, int to, int l=0, int r=n-1, int idx=1) {
  if (fr <= l && r <= to) return tree[x][idx];
  else {
    int m = (l+r)>>1; 
    if (fr > m) {
      return get(x, fr, to, m+1, r, idx<<1|1); 
    } else if (to <= m) {
      return get(x, fr, to, l, m, idx<<1); 
    } else {
      //cerr << x << " " << fr << " " << to << " "<<l<<" " << r<<endl;
      return Secret(get(x, fr, to, m+1, r, idx<<1|1), get(x, fr, to, l, m, idx<<1)); 
    }
  }
}



void Init(int N, int A[]) {
  n=N; 
  for(int i=0; i<N; i++) a[i] = A[i]; 
  build(0); build(1); 
}

int Query(int L, int R) {
  return get(L%2,L-(L%2),R-(L%2));
}
# Verdict Execution time Memory Grader output
1 Incorrect 114 ms 2376 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 307520343.
2 Incorrect 116 ms 2472 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 42053665.
3 Incorrect 112 ms 2384 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 623212824.
4 Incorrect 427 ms 4348 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 587940447.
5 Incorrect 419 ms 4296 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 79316226.
6 Incorrect 432 ms 4508 KB Wrong Answer: Query(738, 741) - expected : 983692994, actual : 52647746.
7 Incorrect 430 ms 4364 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 34090009.
8 Incorrect 453 ms 4492 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 337773832.
9 Incorrect 422 ms 4324 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 298850055.
10 Incorrect 458 ms 4424 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 873597508.