# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
111509 |
2019-05-15T13:43:47 Z |
vex |
비밀 (JOI14_secret) |
C++14 |
|
550 ms |
8440 KB |
#include <bits/stdc++.h>
#include <secret.h>
#define maxn 1005
#define pii pair<int,int>
using namespace std;
int len;
vector<pii>v;
int rez[maxn][maxn];
void napravi(int l,int r,int a[])
{
int duz=r-l+1;
if(duz<=1)return;
int mid=(l+r)/2;
v.push_back({l,r});
rez[mid][mid+1]=a[mid+1];
rez[mid][mid]=a[mid];
for(int i=mid+2;i<=r;i++)rez[mid][i]=Secret(rez[mid][i-1],a[i]);
for(int i=mid-1;i>=l;i--)rez[i][mid]=Secret(a[i],rez[i+1][mid]);
napravi(l,mid-1,a);
napravi(mid+1,r,a);
}
void Init(int n,int a[])
{
len=n;
napravi(0,n-1,a);
}
int Query(int l,int r)
{
for(auto x:v)
{
int ll=x.first;
int rr=x.second;
int mid=(ll+rr)/2;
if(ll<=l && l<=mid && mid<=r && r<=rr)
{
if(r==mid)return rez[l][mid];
return Secret(rez[l][mid],rez[mid][r]);
}
}
}
Compilation message
secret.cpp: In function 'int Query(int, int)':
secret.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
143 ms |
4472 KB |
Wrong Answer: Query(56, 56) - expected : 677274107, actual : 509. |
2 |
Incorrect |
161 ms |
4472 KB |
Wrong Answer: Query(18, 18) - expected : 177796141, actual : 510. |
3 |
Incorrect |
173 ms |
4472 KB |
Wrong Answer: Query(18, 18) - expected : 238214183, actual : 511. |
4 |
Incorrect |
515 ms |
8252 KB |
Wrong Answer: Query(788, 788) - expected : 937598145, actual : 997. |
5 |
Incorrect |
523 ms |
8440 KB |
Wrong Answer: Query(957, 957) - expected : 115761809, actual : 998. |
6 |
Incorrect |
518 ms |
8184 KB |
Wrong Answer: Query(585, 585) - expected : 674906985, actual : 998. |
7 |
Correct |
491 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 |
481 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 |
481 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 |
550 ms |
8232 KB |
Output is correct - number of calls to Secret by Init = 7476, maximum number of calls to Secret by Query = 1 |