답안 #239865

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
239865 2020-06-17T12:25:46 Z MvC 비밀 (JOI14_secret) C++11
0 / 100
509 ms 8608 KB
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include "secret.h"
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define mkp make_pair
#define in insert
#define er erase
#define fd find
#define fr first
#define sc second
#define all(x) x.begin(),x.end()
#define lun(x) (int)x.size()
typedef long long ll;
typedef long double ld;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll llinf=(1LL<<60);
const int inf=(1<<30);
const int nmax=1e3+50;
const ll mod=1e9+7;
using namespace std;
int a[nmax],b[nmax][nmax];
void build(int l,int r)
{
	if(l>=r)return;
	if(l==r-1)
	{
		b[l][r]=Secret(a[l],a[r]);
		return;
	}
	int mid=(l+r)/2;
	for(int i=mid-1;i>=l;i--)b[i][mid]=Secret(a[i],b[i+1][mid]);
	for(int i=mid+2;i<=r;i++)b[mid+1][i]=Secret(b[mid+1][i-1],a[i]);
	build(l,mid);
	build(mid+1,r);
}
void Init(int n,int A[])
{
	for(int i=1;i<=n;i++)a[i]=A[i-1];
	for(int i=1;i<=n;i++)
	{
		for(int j=i;j<=n;j++)
		{
			if(i==j)b[i][i]=a[i];
			else b[i][j]=-1;
		}
	}
	build(1,n);
}
int Query(int l,int r)
{
	if(b[l][r]!=-1)return b[l][r];
	for(int i=l;i<r;i++)if(b[l][i]!=-1 && b[i+1][r]!=-1)return Secret(b[l][i],b[i+1][r]);
}
/*int main()
{
	//freopen("sol.in","r",stdin);
	//freopen("sol.out","w",stdout);
	//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);cin.tie(0);cerr.tie(0);cout.tie(0);
	
	return 0;
}*/

Compilation message

secret.cpp: In function 'int Query(int, int)':
secret.cpp:55:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 139 ms 4600 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 22166791.
2 Incorrect 140 ms 4472 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 306225408.
3 Incorrect 144 ms 4472 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 629483540.
4 Incorrect 500 ms 8544 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 34079308.
5 Incorrect 504 ms 8608 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 542818560.
6 Incorrect 496 ms 8440 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 579799611.
7 Incorrect 497 ms 8444 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 772352096.
8 Incorrect 498 ms 8440 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 290455552.
9 Incorrect 509 ms 8440 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 164632041.
10 Incorrect 506 ms 8568 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 872638089.