Submission #391256

# Submission time Handle Problem Language Result Execution time Memory
391256 2021-04-18T10:13:01 Z Vladth11 Secret (JOI14_secret) C++14
6 / 100
9375 ms 8224 KB
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debug_with_space(x) cerr << #x << " " << x << " "
#include "secret.h"
 
using namespace std;
typedef long long ll;
typedef pair <ll, ll> pii;
typedef pair <long double, pii> muchie;
 
const ll NMAX = 300001;
const ll INF = (1LL << 60);
const ll MOD = 998244353;
const ll BLOCK = 225;
const ll base = 31;
const ll nr_of_bits = 21;
 
int table[1001][1001], n;
 
void divide(int l, int r){
  	if(l == r || l > r)
      return;
    int mid = (l + r) / 2;
    for(int i = mid - 1; i >= l; i--){
        table[i][mid] = Secret(table[i + 1][mid], table[i][i]);
    }
    for(int i = mid + 2; i <= r; i++){
        table[mid + 1][i] = Secret(table[mid + 1][i - 1], table[i][i]);
    }
    divide(l, mid);
    divide(mid + 1, r);
}
 
void Init(int N, int A[]) {
  n = N;
  for(int i = 0; i < N; i++)
    table[i][i] = A[i];
  divide(0, N - 1);
}
 
int q(int st, int dr, int l, int r){
    int mid = (st + dr) / 2;
  	if(st == dr)
      return table[st][dr];
    if(l <= mid && mid + 1 <= r){
        return Secret(q(st, mid, l, mid), q(mid + 1, dr, mid + 1, r));
    }
    if(r <= mid){
        return q(st, mid, l, r);
    }
    if(l > mid){
        return q(mid + 1, dr, l, r);
    }
}
 
int Query(int L, int R) {
    return q(0, n - 1, L, R);
}

Compilation message

secret.cpp: In function 'int q(int, int, int, int)':
secret.cpp:54:1: warning: control reaches end of non-void function [-Wreturn-type]
   54 | }
      | ^
# Verdict Execution time Memory Grader output
1 Partially correct 1755 ms 4368 KB Output isn't correct - number of calls to Secret by Init = 3578, maximum number of calls to Secret by Query = 506
2 Partially correct 1713 ms 4376 KB Output isn't correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 508
3 Partially correct 1775 ms 4384 KB Output isn't correct - number of calls to Secret by Init = 3595, maximum number of calls to Secret by Query = 505
4 Partially correct 3697 ms 8188 KB Output isn't correct - number of calls to Secret by Init = 7969, maximum number of calls to Secret by Query = 997
5 Partially correct 3823 ms 8224 KB Output isn't correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 992
6 Partially correct 537 ms 8192 KB Output is partially correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 10
7 Partially correct 9375 ms 8224 KB Output isn't correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 999
8 Partially correct 9047 ms 8188 KB Output isn't correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 999
9 Partially correct 9100 ms 8192 KB Output isn't correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 998
10 Partially correct 9083 ms 8188 KB Output isn't correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 999