답안 #258712

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
258712 2020-08-06T12:07:29 Z fedoseevtimofey 비밀 (JOI14_secret) C++14
0 / 100
799 ms 524292 KB
#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <random>
#include <iomanip>
#include <functional>
#include <cassert>

using namespace std;

typedef long long ll;

#include "secret.h"

const int N = 1007;
int val[N][N];
int n;

void Init(int nn, int A[]) {
  n = nn;
  function <void(int, int)> rec = [&] (int l, int r) {
    if (l > r) return;
    int m = (l + r) >> 1;
    rec(l, m - 1);
    rec(m + 1, r);
    val[m][m] = A[m];
    for (int i = m - 1; i >= l; --i) {
      val[m][i] = Secret(A[i], val[m][i + 1]);
    }
    if (m < r) {
      val[m][m + 1] = A[m + 1];
      for (int i = m + 2; i <= r; ++i) {
        val[m][i] = Secret(val[m][i - 1], A[i]);
      }
    }
  };  
  rec(0, n - 1);
}

int Query(int ql, int qr) {
  function <int(int, int)> rec = [&] (int l, int r) {
    int m = (l + r) >> 1;
    if (ql <= m && m <= qr) {
      int vl = val[m][ql];
      if (qr != m) {
        vl = Secret(vl, val[m][qr]);
      }
      return vl;
    } else {
      if (r < m) {
        return rec(l, m - 1);
      } else {
        return rec(m + 1, r);
      }
    }
  };  
  return rec(0, n - 1);
}
# 결과 실행 시간 메모리 Grader output
1 Runtime error 427 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Runtime error 426 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
3 Runtime error 427 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
4 Runtime error 791 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
5 Runtime error 773 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
6 Runtime error 799 ms 524292 KB Execution killed with signal 9 (could be triggered by violating memory limits)
7 Correct 516 ms 8312 KB Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1
8 Correct 509 ms 8312 KB Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1
9 Correct 509 ms 8312 KB Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1
10 Correct 516 ms 8312 KB Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1