답안 #133286

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
133286 2019-07-20T11:13:46 Z egorlifar 비밀 (JOI14_secret) C++17
30 / 100
657 ms 4600 KB
#include "secret.h"
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;
template<typename T1, typename T2>inline void chkmin(T1 &x, T2 y) { if (x > y) x = y; }
template<typename T1, typename T2>inline void chkmax(T1 &x, T2 y) { if (x < y) x = y; }
#define sz(c) (int)(c).size()
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define left left224
#define right right224
#define next next224
#define rank rank224
#define prev prev224
#define y1 y1224
#define read(FILENAME) freopen((FILENAME + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((FILENAME + ".out").c_str(), "w", stdout)
#define files(FILENAME) read(FILENAME), write(FILENAME)
#define pb push_back
#define mp make_pair
const int MAXN = 1001;


int n;
int val[MAXN][10];


void Init(int N, int A[]) {
	n = N;
	for (int i = 0; i < n; i++) {
		val[i][0] = A[i];
	}
	for (int k = 1; k <= 9; k++) {
		for (int i = 0; i <= n - (1 << k); i++) {
			val[i][k] = Secret(val[i][k - 1], val[i + (1 << (k - 1))][k - 1]);
		}
	}
}

int Query(int L, int R) {
	int l = L;
	int r = R;
	int last = -1;
	for (int i = 9; i >= 0; i--) {
		if (l + (1 << i) - 1 <= r) {
			if (last == -1) {
				last = val[l][i];
			} else {
				last = Secret(last, val[l][i]);
			}
			l += (1 << i);
		}
	}
  	return last;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 195 ms 2884 KB Output is partially correct - number of calls to Secret by Init = 3586, maximum number of calls to Secret by Query = 7
2 Partially correct 198 ms 2552 KB Output is partially correct - number of calls to Secret by Init = 3595, maximum number of calls to Secret by Query = 7
3 Partially correct 196 ms 2492 KB Output is partially correct - number of calls to Secret by Init = 3604, maximum number of calls to Secret by Query = 7
4 Partially correct 626 ms 4560 KB Output is partially correct - number of calls to Secret by Init = 7978, maximum number of calls to Secret by Query = 8
5 Partially correct 627 ms 4600 KB Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8
6 Partially correct 597 ms 4432 KB Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 2
7 Partially correct 654 ms 4544 KB Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8
8 Partially correct 638 ms 4484 KB Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 7
9 Partially correct 657 ms 4600 KB Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 8
10 Partially correct 638 ms 4472 KB Output is partially correct - number of calls to Secret by Init = 7987, maximum number of calls to Secret by Query = 7