Submission #1018608

# Submission time Handle Problem Language Result Execution time Memory
1018608 2024-07-10T07:24:10 Z dosts Secret (JOI14_secret) C++17
0 / 100
322 ms 4520 KB
#include "secret.h"
#include <bits/stdc++.h>
//Dost SEFEROĞLU
using namespace std;
#define int long long
#define pii pair<int,int>
#define ff first
#define ss second
#define sp << " " << 
#define vi vector<int>
#define all(xx) xx.begin(),xx.end()
#define ps(xxx) cout << (xxx) << endl;


int dat[10][1001];
int mask[1001];
int B[1001];

void dnc(int l,int r,int level = 0) {
  if (l == r) return;
  int m = (l+r) >> 1;
  dat[level][m] = B[m];
  for (int i=m-1;i>=l;i--) dat[level][i] = Secret(B[i],dat[level][i+1]);
  dat[level][m+1] = B[m+1];
  for (int i=m+2;i<=r;i++) dat[level][i] = Secret(dat[level][i-1],B[i]);
  for (int i=m+1;i<=r;i++) mask[i]^=(1<<level);
  dnc(l,m,level+1),dnc(m+1,r,level+1);
}

void Init(int32_t N, int32_t A[]) {
  for (int i=0;i<N;i++) B[i+1] = A[i];
  dnc(1,N);
}

int32_t Query(int32_t L, int32_t R) {
  if (L == R) return B[L];
  int tz = __builtin_ctz(mask[L]^mask[R]);
  return Secret(dat[tz][L],dat[tz][R]);
}
# Verdict Execution time Memory Grader output
1 Incorrect 79 ms 2736 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 22166791.
2 Incorrect 79 ms 2736 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 306225408.
3 Incorrect 91 ms 2736 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 629483540.
4 Incorrect 300 ms 4276 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 34079308.
5 Incorrect 293 ms 4432 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 542818560.
6 Incorrect 302 ms 4436 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 579799611.
7 Incorrect 292 ms 4432 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 772352096.
8 Incorrect 322 ms 4288 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 290455552.
9 Incorrect 303 ms 4436 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 164632041.
10 Incorrect 308 ms 4520 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 872638089.