Submission #227575

# Submission time Handle Problem Language Result Execution time Memory
227575 2020-04-27T21:42:27 Z blacktulip Triple Jump (JOI19_jumps) C++17
5 / 100
4000 ms 33400 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long lo;
typedef pair< lo,lo > PII;

#define fi first
#define se second
#define int long long
#define mp make_pair
#define pb push_back
#define fio() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define FOR for(int i=1;i<=n;i++)
#define mid ((start+end)/2)
#define ort ((bas+son)/2)

const lo MAX = -1000000000000000000;
const lo MIN = 1000000000000000000;
const lo inf = 1000000000;
const lo KOK = 100000;
const lo LOG = 30;
const lo li = 200002;
const lo mod = 1000000007;

int n,m,b[li],a[li],k,flag,t,l,r,dp[li][5];
int cev;
string s;
vector<int> v;

inline int f(int sira,int hangi,int bas){
	int cevv=-inf;
	if(sira>r){
		if(hangi==2)return 0;
		return -inf;
	}
	if(~dp[sira][hangi])return dp[sira][hangi];
	if(hangi==0){
		cevv=max(cevv,f(sira+1,hangi,bas));
		for(int i=bas;i<sira;i++)cevv=max(cevv,f(sira+(sira-i),1,bas)+a[sira]+a[i]);
	}
	else{
		cevv=max(cevv,f(sira+1,hangi,bas));
		cevv=max(cevv,f(r+1,2,bas)+a[sira]);
	}
	return dp[sira][hangi]=cevv;
}

main(void){
	
	scanf("%lld",&n);
	FOR scanf("%lld",&a[i]);
	scanf("%lld",&t);
	while(t--){
		memset(dp,-1,sizeof(dp));
		scanf("%lld %lld",&l,&r);
		cev=f(l+1,0,l);
		printf("%lld\n",cev);
	}
	return 0;
}

Compilation message

jumps.cpp:49:10: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(void){
          ^
jumps.cpp: In function 'int main()':
jumps.cpp:51:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&n);
  ~~~~~^~~~~~~~~~~
jumps.cpp:52:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  FOR scanf("%lld",&a[i]);
      ~~~~~^~~~~~~~~~~~~~
jumps.cpp:53:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld",&t);
  ~~~~~^~~~~~~~~~~
jumps.cpp:56:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld %lld",&l,&r);
   ~~~~~^~~~~~~~~~~~~~~~~~~
jumps.cpp:33:2: warning: assuming signed overflow does not occur when assuming that (X + c) >= X is always true [-Wstrict-overflow]
  if(sira>r){
  ^~
# Verdict Execution time Memory Grader output
1 Correct 9 ms 8192 KB Output is correct
2 Correct 100 ms 8192 KB Output is correct
3 Correct 93 ms 8192 KB Output is correct
4 Correct 62 ms 8192 KB Output is correct
5 Correct 88 ms 8192 KB Output is correct
6 Correct 68 ms 8192 KB Output is correct
7 Correct 92 ms 8192 KB Output is correct
8 Correct 64 ms 8192 KB Output is correct
9 Correct 90 ms 8192 KB Output is correct
10 Correct 63 ms 8192 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 8192 KB Output is correct
2 Correct 100 ms 8192 KB Output is correct
3 Correct 93 ms 8192 KB Output is correct
4 Correct 62 ms 8192 KB Output is correct
5 Correct 88 ms 8192 KB Output is correct
6 Correct 68 ms 8192 KB Output is correct
7 Correct 92 ms 8192 KB Output is correct
8 Correct 64 ms 8192 KB Output is correct
9 Correct 90 ms 8192 KB Output is correct
10 Correct 63 ms 8192 KB Output is correct
11 Execution timed out 4054 ms 8960 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 4058 ms 33400 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 8192 KB Output is correct
2 Correct 100 ms 8192 KB Output is correct
3 Correct 93 ms 8192 KB Output is correct
4 Correct 62 ms 8192 KB Output is correct
5 Correct 88 ms 8192 KB Output is correct
6 Correct 68 ms 8192 KB Output is correct
7 Correct 92 ms 8192 KB Output is correct
8 Correct 64 ms 8192 KB Output is correct
9 Correct 90 ms 8192 KB Output is correct
10 Correct 63 ms 8192 KB Output is correct
11 Execution timed out 4054 ms 8960 KB Time limit exceeded
12 Halted 0 ms 0 KB -