답안 #235616

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
235616 2020-05-28T20:21:04 Z Blagojce 비밀 (JOI14_secret) C++11
30 / 100
601 ms 4628 KB
#include <bits/stdc++.h> 
#define fr(i, n, m) for(int i = (n); i < (m); i ++)
#define pb push_back
#define st first
#define nd second
#define pq priority_queue
#define all(x) begin(x), end(x)
#include <time.h>
#include <cmath>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const ll inf = 1e18;
const ll mod = 1000000007;
const ld eps = 1e-13;
const ld pi  = 3.14159265359;
 
mt19937 _rand(time(NULL));
clock_t timer = clock();
const int mxn = 5e5 + 5;
 
#include "secret.h"
 
 
int seg[10000];
int n;
int a[1001];
void build(int k, int l, int r){
	if(l == r){
		seg[k] = a[l];
		return;
	}
	int mid = (l + r) / 2;
	build(k * 2, l, mid);
	build(k * 2 + 1, mid + 1, r);
	seg[k] = Secret(seg[k * 2], seg[k * 2 + 1]);
}
vector<int> v;
void query(int k, int l, int r, int x, int y){
	if(y < l || r < x) return;
	
	if(x <= l && r <= y){
		v.pb(seg[k]);
		return;
	}
	int mid = (l + r) / 2;
	query(k * 2, l, mid, x, y);
	query(k * 2 + 1, mid + 1, r, x, y);
}
 
void Init(int N, int A[]) {
	n = N;
	fr(i, 0, N){
		a[i] = A[i];
	}
	build(1, 0, n-1);
}
 
int Query(int L, int R){
	v.clear();
	query(1, 0, n - 1, L, R);
	int ans = v[0];
	fr(i, 1, (int)v.size()){
		ans = Secret(ans, v[i]);
	}
	
	return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Partially correct 195 ms 2552 KB Output is partially correct - number of calls to Secret by Init = 510, maximum number of calls to Secret by Query = 13
2 Partially correct 195 ms 2552 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 195 ms 2552 KB Output is partially correct - number of calls to Secret by Init = 512, maximum number of calls to Secret by Query = 15
4 Partially correct 571 ms 4492 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 574 ms 4344 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 15
6 Partially correct 527 ms 4344 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 601 ms 4344 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 597 ms 4600 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 596 ms 4472 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16
10 Partially correct 594 ms 4628 KB Output is partially correct - number of calls to Secret by Init = 999, maximum number of calls to Secret by Query = 16