Submission #636812

# Submission time Handle Problem Language Result Execution time Memory
636812 2022-08-30T08:58:44 Z lovrot Boat (APIO16_boat) C++11
9 / 100
3 ms 2372 KB
#include <bits/stdc++.h> 

#define ll long long

using namespace std; 

const int N = 510;
const int MOD = 1e9 + 7;

ll add(ll x, ll y){ 
	return (x + y) % MOD;
}

int n, a[N], b[N];
ll dp[N][N]; 

ll DP(int x, int last){ 
	if(x > n) return 1;
	if(dp[x][last] != -1) return dp[x][last];
	dp[x][last] = DP(x + 1, last);
	if(a[last] < a[x])
		dp[x][last] = add(dp[x][last], DP(x + 1, x));
	return dp[x][last];
}

int main(){ 
	memset(dp, -1, sizeof(dp));
	scanf("%d", &n);
	for(int i = 1; i <= n; i++){ 
		scanf("%d%d", &a[i], &b[i]);
	}
	printf("%d\n", DP(1, 0) - 1);
	return 0;
}

Compilation message

boat.cpp: In function 'int main()':
boat.cpp:32:11: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   32 |  printf("%d\n", DP(1, 0) - 1);
      |          ~^     ~~~~~~~~~~~~
      |           |              |
      |           int            long long int
      |          %lld
boat.cpp:28:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   28 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
boat.cpp:30:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |   scanf("%d%d", &a[i], &b[i]);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2260 KB Output is correct
2 Correct 3 ms 2348 KB Output is correct
3 Correct 2 ms 2260 KB Output is correct
4 Correct 3 ms 2260 KB Output is correct
5 Correct 3 ms 2260 KB Output is correct
6 Correct 2 ms 2260 KB Output is correct
7 Correct 3 ms 2260 KB Output is correct
8 Correct 3 ms 2260 KB Output is correct
9 Correct 3 ms 2260 KB Output is correct
10 Correct 3 ms 2260 KB Output is correct
11 Correct 3 ms 2260 KB Output is correct
12 Correct 3 ms 2372 KB Output is correct
13 Correct 3 ms 2260 KB Output is correct
14 Correct 3 ms 2260 KB Output is correct
15 Correct 2 ms 2260 KB Output is correct
16 Correct 3 ms 2348 KB Output is correct
17 Correct 3 ms 2260 KB Output is correct
18 Correct 3 ms 2260 KB Output is correct
19 Correct 3 ms 2348 KB Output is correct
20 Correct 2 ms 2260 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2260 KB Output is correct
2 Correct 3 ms 2348 KB Output is correct
3 Correct 2 ms 2260 KB Output is correct
4 Correct 3 ms 2260 KB Output is correct
5 Correct 3 ms 2260 KB Output is correct
6 Correct 2 ms 2260 KB Output is correct
7 Correct 3 ms 2260 KB Output is correct
8 Correct 3 ms 2260 KB Output is correct
9 Correct 3 ms 2260 KB Output is correct
10 Correct 3 ms 2260 KB Output is correct
11 Correct 3 ms 2260 KB Output is correct
12 Correct 3 ms 2372 KB Output is correct
13 Correct 3 ms 2260 KB Output is correct
14 Correct 3 ms 2260 KB Output is correct
15 Correct 2 ms 2260 KB Output is correct
16 Correct 3 ms 2348 KB Output is correct
17 Correct 3 ms 2260 KB Output is correct
18 Correct 3 ms 2260 KB Output is correct
19 Correct 3 ms 2348 KB Output is correct
20 Correct 2 ms 2260 KB Output is correct
21 Incorrect 2 ms 2260 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 2260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2260 KB Output is correct
2 Correct 3 ms 2348 KB Output is correct
3 Correct 2 ms 2260 KB Output is correct
4 Correct 3 ms 2260 KB Output is correct
5 Correct 3 ms 2260 KB Output is correct
6 Correct 2 ms 2260 KB Output is correct
7 Correct 3 ms 2260 KB Output is correct
8 Correct 3 ms 2260 KB Output is correct
9 Correct 3 ms 2260 KB Output is correct
10 Correct 3 ms 2260 KB Output is correct
11 Correct 3 ms 2260 KB Output is correct
12 Correct 3 ms 2372 KB Output is correct
13 Correct 3 ms 2260 KB Output is correct
14 Correct 3 ms 2260 KB Output is correct
15 Correct 2 ms 2260 KB Output is correct
16 Correct 3 ms 2348 KB Output is correct
17 Correct 3 ms 2260 KB Output is correct
18 Correct 3 ms 2260 KB Output is correct
19 Correct 3 ms 2348 KB Output is correct
20 Correct 2 ms 2260 KB Output is correct
21 Incorrect 2 ms 2260 KB Output isn't correct
22 Halted 0 ms 0 KB -