Submission #391253

# Submission time Handle Problem Language Result Execution time Memory
391253 2021-04-18T10:09:03 Z Vladth11 Secret (JOI14_secret) C++14
0 / 100
516 ms 8260 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(table[l][mid], table[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 Incorrect 132 ms 4292 KB Wrong Answer: Query(113, 206) - expected : 536899947, actual : 538256673.
2 Incorrect 132 ms 4340 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 311474560.
3 Incorrect 133 ms 4344 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 353554500.
4 Incorrect 509 ms 8152 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 343081568.
5 Incorrect 494 ms 8244 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 957013316.
6 Incorrect 516 ms 8196 KB Wrong Answer: Query(747, 749) - expected : 244228265, actual : 935077363.
7 Incorrect 505 ms 8260 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 675449873.
8 Incorrect 505 ms 8204 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 273091792.
9 Incorrect 497 ms 8080 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 827853577.
10 Incorrect 510 ms 8184 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 337854787.