# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
286170 |
2020-08-30T07:54:14 Z |
YJU |
비밀 (JOI14_secret) |
C++14 |
|
790 ms |
524292 KB |
#include<bits/stdc++.h>
#include "secret.h"
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> pll;
const ll MOD=1e9+7;
const ll MOD2=998244353;
const ll N=1e3+5;
const ld pi=3.14159265359;
const ll INF=(1LL<<60);
#define SQ(i) ((i)*(i))
#define REP(i,n) for(ll i=0;i<n;i++)
#define REP1(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define setp setprecision
#define lwb lower_bound
#define SZ(_a) (ll)_a.size()
ll pre[N][N],suf[N][N],n,u[N];
void Init(int N,int a[]){
n=N;
REP(i,n)u[i]=a[i];
function<void(ll,ll)> build = [&](ll l,ll r){
if(l>=r)return ;
ll mid=(l+r+1)/2;
build(l,mid);build(mid+1,r);
pre[mid][mid]=a[mid];
suf[mid][mid-1]=a[mid-1];
for(int i=mid+1;i<=r;i++)pre[mid][i]=Secret(pre[mid][i-1],a[i]);
for(int i=mid-2;i>=l;i--)suf[mid][i]=Secret(a[i],suf[mid][i+1]);
};
build(0,n-1);
}
ll q(ll l,ll r,ll ql,ll qr){
ll mid=(l+r+1)/2;
if(qr<mid-1)return q(l,mid-1,ql,qr);
if(ql>mid)return q(mid+1,r,ql,qr);
if(ql==mid)return pre[mid][qr];
if(qr==mid-1)return suf[mid][ql];
return Secret(pre[mid][qr],suf[mid][ql]);
}
int Query(int L,int R){
if(L==R)return u[L];
return q(0,n-1,L,R);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
425 ms |
524292 KB |
Execution killed with signal 9 |
2 |
Runtime error |
414 ms |
524288 KB |
Execution killed with signal 9 |
3 |
Runtime error |
426 ms |
524292 KB |
Execution killed with signal 9 |
4 |
Runtime error |
780 ms |
524292 KB |
Execution killed with signal 9 |
5 |
Runtime error |
780 ms |
524292 KB |
Execution killed with signal 9 |
6 |
Runtime error |
783 ms |
524292 KB |
Execution killed with signal 9 |
7 |
Runtime error |
776 ms |
524292 KB |
Execution killed with signal 9 |
8 |
Runtime error |
779 ms |
524292 KB |
Execution killed with signal 9 |
9 |
Runtime error |
779 ms |
524292 KB |
Execution killed with signal 9 |
10 |
Runtime error |
790 ms |
524292 KB |
Execution killed with signal 9 |