Submission #247425

# Submission time Handle Problem Language Result Execution time Memory
247425 2020-07-11T11:00:44 Z receed Secret (JOI14_secret) C++14
0 / 100
523 ms 9056 KB
#include "secret.h"
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <cassert>
#include <string>
#include <set>
#include <map>
#include <random>
#include <bitset>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <queue>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;
using ul = unsigned long long;
using ld = long double;

const int N = 1000, L = 9;
int d[L][N];


void Init(int n, int a[]) {
    for (int i = 0; (1 << i) <= n; i++) {
        int pw = 1 << i;
        for (int j = pw; j <= n; j += pw * 2) {
            d[i][j - 1] = a[j - 1];
            if (j < n)
                d[i][j] = a[j];
            for (int k = j - 2; k >= j - pw; k--)
                d[i][k] = Secret(a[k], d[i][k + 1]);
            for (int k = j + 1; k < min(n, j + pw); k++)
                d[i][k] = Secret(d[i][k - 1], a[k]);
        }
    }
}

int Query(int l, int r) {
    if (l == r)
        return d[0][l];
    int x = l ^ r, pos = 0;
    while ((2 << pos) <= x)
        pos++;
    return Secret(d[pos][l], d[pos][r]);
}
# Verdict Execution time Memory Grader output
1 Correct 146 ms 2552 KB Output is correct - number of calls to Secret by Init = 3578, maximum number of calls to Secret by Query = 1
2 Runtime error 151 ms 4856 KB Execution killed with signal 11 (could be triggered by violating memory limits)
3 Runtime error 152 ms 4856 KB Execution killed with signal 11 (could be triggered by violating memory limits)
4 Runtime error 504 ms 8696 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Runtime error 520 ms 8968 KB Execution killed with signal 11 (could be triggered by violating memory limits)
6 Runtime error 513 ms 8720 KB Execution killed with signal 11 (could be triggered by violating memory limits)
7 Runtime error 518 ms 8824 KB Execution killed with signal 11 (could be triggered by violating memory limits)
8 Runtime error 518 ms 8800 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 515 ms 8820 KB Execution killed with signal 11 (could be triggered by violating memory limits)
10 Runtime error 523 ms 9056 KB Execution killed with signal 11 (could be triggered by violating memory limits)