답안 #40051

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
40051 2018-01-26T02:00:12 Z funcsr 비밀 (JOI14_secret) C++14
30 / 100
735 ms 6020 KB
#include "secret.h"
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(x) x.begin(), x.end()
#define uniq(x) x.erase(unique(all(x)), x.end())
#define index(x, y) (int)(lower_bound(all(x), y) - x.begin())
#define pb push_back
#define NIL 1145141919
#define MAX_N (1<<10)
int seg[MAX_N*2-1];
int op(int x, int y) {
  if (x == NIL) return y;
  if (y == NIL) return x;
  return Secret(x, y);
}
int query(int a, int b, int k=0, int l=0, int r=MAX_N) {
  if (b <= l || r <= a) return NIL;
  if (a <= l && r <= b) return seg[k];
  return op(query(a, b, k*2+1, l, (l+r)/2), query(a, b, k*2+2, (l+r)/2, r));
}

void Init(int N, int A[]) {
  fill(seg, seg+MAX_N*2-1, NIL);
  rep(i, N) seg[i+MAX_N-1] = A[i];
  for (int i=MAX_N-2; i>=0; i--) {
    seg[i] = op(seg[i*2+1], seg[i*2+2]);
  }
}

int Query(int L, int R) {
  return query(L, R+1);
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 228 ms 6020 KB Output is partially correct - number of calls to Secret by Init = 510, maximum number of calls to Secret by Query = 14
2 Partially correct 236 ms 6020 KB Output is partially correct - number of calls to Secret by Init = 511, maximum number of calls to Secret by Query = 14
3 Partially correct 229 ms 6020 KB Output is partially correct - number of calls to Secret by Init = 512, maximum number of calls to Secret by Query = 14
4 Partially correct 671 ms 6020 KB Output is partially correct - number of calls to Secret by Init = 998, maximum number of calls to Secret by Query = 15
5 Partially correct 663 ms 6020 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 14
6 Partially correct 610 ms 6020 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 4
7 Partially correct 684 ms 6020 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16
8 Partially correct 680 ms 6020 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16
9 Partially correct 684 ms 6020 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 15
10 Partially correct 735 ms 6020 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16