Submission #239859

# Submission time Handle Problem Language Result Execution time Memory
239859 2020-06-17T12:19:34 Z MvC Secret (JOI14_secret) C++11
0 / 100
507 ms 8680 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(l,r);
		return;
	}
	int mid=(l+r)/2;
	for(int i=mid-1;i>=l;i--)b[i][mid]=Secret(b[i+1][mid],a[i]);
	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]
 }
 ^
# Verdict Execution time Memory Grader output
1 Incorrect 136 ms 4600 KB Wrong Answer: Query(222, 254) - expected : 34031541, actual : 823269916.
2 Incorrect 138 ms 4600 KB Wrong Answer: Query(60, 375) - expected : 669221184, actual : 617718217.
3 Incorrect 146 ms 4600 KB Wrong Answer: Query(211, 401) - expected : 674373968, actual : 890384668.
4 Incorrect 507 ms 8680 KB Wrong Answer: Query(90, 497) - expected : 397934825, actual : 360940085.
5 Incorrect 498 ms 8568 KB Wrong Answer: Query(587, 915) - expected : 752404486, actual : 156255302.
6 Incorrect 506 ms 8568 KB Wrong Answer: Query(915, 915) - expected : 282904741, actual : 579799611.
7 Incorrect 497 ms 8544 KB Wrong Answer: Query(84, 976) - expected : 742463504, actual : 26286184.
8 Incorrect 502 ms 8568 KB Wrong Answer: Query(58, 987) - expected : 20022464, actual : 218338632.
9 Incorrect 507 ms 8548 KB Wrong Answer: Query(33, 967) - expected : 676869696, actual : 1844106.
10 Incorrect 503 ms 8568 KB Wrong Answer: Query(116, 961) - expected : 68487362, actual : 339480203.