Submission #40872

# Submission time Handle Problem Language Result Execution time Memory
40872 2018-02-09T15:24:52 Z gabrielsimoes Boat (APIO16_boat) C++14
9 / 100
3 ms 656 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const ll MOD = 1000000007;
const int MAXN = 510;

int n;
int va[MAXN], vb[MAXN];
ll dp[MAXN];

int main() {
	va[0] = vb[0] = 0;
	dp[0] = 1;

	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d %d", &va[i], &vb[i]);
	}

	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		for (int k = 0; k < i; k++) {
			if (va[k] < va[i]) {
				dp[i] += dp[k];
				dp[i] %= MOD;
			}
		}
		ans += dp[i];
		ans %= MOD;
	}

	printf("%lld\n", ans);
}

Compilation message

boat.cpp: In function 'int main()':
boat.cpp:16:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
                 ^
boat.cpp:18:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &va[i], &vb[i]);
                                 ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 500 KB Output is correct
3 Correct 2 ms 656 KB Output is correct
4 Correct 2 ms 656 KB Output is correct
5 Correct 2 ms 656 KB Output is correct
6 Correct 2 ms 656 KB Output is correct
7 Correct 2 ms 656 KB Output is correct
8 Correct 2 ms 656 KB Output is correct
9 Correct 3 ms 656 KB Output is correct
10 Correct 2 ms 656 KB Output is correct
11 Correct 2 ms 656 KB Output is correct
12 Correct 3 ms 656 KB Output is correct
13 Correct 3 ms 656 KB Output is correct
14 Correct 2 ms 656 KB Output is correct
15 Correct 2 ms 656 KB Output is correct
16 Correct 2 ms 656 KB Output is correct
17 Correct 2 ms 656 KB Output is correct
18 Correct 2 ms 656 KB Output is correct
19 Correct 2 ms 656 KB Output is correct
20 Correct 2 ms 656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 500 KB Output is correct
3 Correct 2 ms 656 KB Output is correct
4 Correct 2 ms 656 KB Output is correct
5 Correct 2 ms 656 KB Output is correct
6 Correct 2 ms 656 KB Output is correct
7 Correct 2 ms 656 KB Output is correct
8 Correct 2 ms 656 KB Output is correct
9 Correct 3 ms 656 KB Output is correct
10 Correct 2 ms 656 KB Output is correct
11 Correct 2 ms 656 KB Output is correct
12 Correct 3 ms 656 KB Output is correct
13 Correct 3 ms 656 KB Output is correct
14 Correct 2 ms 656 KB Output is correct
15 Correct 2 ms 656 KB Output is correct
16 Correct 2 ms 656 KB Output is correct
17 Correct 2 ms 656 KB Output is correct
18 Correct 2 ms 656 KB Output is correct
19 Correct 2 ms 656 KB Output is correct
20 Correct 2 ms 656 KB Output is correct
21 Incorrect 2 ms 656 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 656 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 500 KB Output is correct
3 Correct 2 ms 656 KB Output is correct
4 Correct 2 ms 656 KB Output is correct
5 Correct 2 ms 656 KB Output is correct
6 Correct 2 ms 656 KB Output is correct
7 Correct 2 ms 656 KB Output is correct
8 Correct 2 ms 656 KB Output is correct
9 Correct 3 ms 656 KB Output is correct
10 Correct 2 ms 656 KB Output is correct
11 Correct 2 ms 656 KB Output is correct
12 Correct 3 ms 656 KB Output is correct
13 Correct 3 ms 656 KB Output is correct
14 Correct 2 ms 656 KB Output is correct
15 Correct 2 ms 656 KB Output is correct
16 Correct 2 ms 656 KB Output is correct
17 Correct 2 ms 656 KB Output is correct
18 Correct 2 ms 656 KB Output is correct
19 Correct 2 ms 656 KB Output is correct
20 Correct 2 ms 656 KB Output is correct
21 Incorrect 2 ms 656 KB Output isn't correct
22 Halted 0 ms 0 KB -