Submission #433566

# Submission time Handle Problem Language Result Execution time Memory
433566 2021-06-20T07:32:08 Z JeanBombeur Boat (APIO16_boat) C++17
9 / 100
4 ms 2252 KB
#include <iostream>
#include <cstdio>
#define int long long
using namespace std;

//  <|°_°|>

const int MOD = (1000 * 1000 * 1000 + 7);
const int MAX_BATEAUX = (501);

int DP[MAX_BATEAUX][MAX_BATEAUX];

pair <int, int> Bornes[MAX_BATEAUX];

int nbGroupes;

void Read() {
	scanf("%lld", &nbGroupes);
	for (int i = 1; i <= nbGroupes; i ++)
	{
		scanf("%lld %lld", &Bornes[i].first, &Bornes[i].second);
	}
	nbGroupes ++;
	return;
}

void Solve() {
	DP[0][0] = 1;
	for (int i = 0; i < nbGroupes - 1; i ++)
	{
		for (int j = 0; j < nbGroupes; j ++)
		{
			DP[i][j] %= MOD;
			DP[i + 1][j] += DP[i][j];
			if (Bornes[i + 1].first > Bornes[j].first)
				DP[i + 1][i + 1] += DP[i][j];
		}
	}
	int sum = -1;
	for (int i = 0; i < nbGroupes; i ++)
	{
		sum += DP[nbGroupes - 1][i];
	}
	printf("%lld\n", sum % MOD);
	return;
}

signed main() {
	Read();
	Solve();
	return 0;
}

Compilation message

boat.cpp: In function 'void Read()':
boat.cpp:18:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |  scanf("%lld", &nbGroupes);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~
boat.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   21 |   scanf("%lld %lld", &Bornes[i].first, &Bornes[i].second);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2252 KB Output is correct
2 Correct 4 ms 2252 KB Output is correct
3 Correct 3 ms 2252 KB Output is correct
4 Correct 3 ms 2252 KB Output is correct
5 Correct 3 ms 2252 KB Output is correct
6 Correct 2 ms 2252 KB Output is correct
7 Correct 2 ms 2224 KB Output is correct
8 Correct 2 ms 2252 KB Output is correct
9 Correct 2 ms 2216 KB Output is correct
10 Correct 3 ms 2252 KB Output is correct
11 Correct 2 ms 2252 KB Output is correct
12 Correct 2 ms 2252 KB Output is correct
13 Correct 2 ms 2252 KB Output is correct
14 Correct 3 ms 2252 KB Output is correct
15 Correct 2 ms 2252 KB Output is correct
16 Correct 3 ms 2252 KB Output is correct
17 Correct 3 ms 2252 KB Output is correct
18 Correct 3 ms 2252 KB Output is correct
19 Correct 3 ms 2252 KB Output is correct
20 Correct 3 ms 2252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2252 KB Output is correct
2 Correct 4 ms 2252 KB Output is correct
3 Correct 3 ms 2252 KB Output is correct
4 Correct 3 ms 2252 KB Output is correct
5 Correct 3 ms 2252 KB Output is correct
6 Correct 2 ms 2252 KB Output is correct
7 Correct 2 ms 2224 KB Output is correct
8 Correct 2 ms 2252 KB Output is correct
9 Correct 2 ms 2216 KB Output is correct
10 Correct 3 ms 2252 KB Output is correct
11 Correct 2 ms 2252 KB Output is correct
12 Correct 2 ms 2252 KB Output is correct
13 Correct 2 ms 2252 KB Output is correct
14 Correct 3 ms 2252 KB Output is correct
15 Correct 2 ms 2252 KB Output is correct
16 Correct 3 ms 2252 KB Output is correct
17 Correct 3 ms 2252 KB Output is correct
18 Correct 3 ms 2252 KB Output is correct
19 Correct 3 ms 2252 KB Output is correct
20 Correct 3 ms 2252 KB Output is correct
21 Incorrect 3 ms 2252 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2252 KB Output is correct
2 Correct 4 ms 2252 KB Output is correct
3 Correct 3 ms 2252 KB Output is correct
4 Correct 3 ms 2252 KB Output is correct
5 Correct 3 ms 2252 KB Output is correct
6 Correct 2 ms 2252 KB Output is correct
7 Correct 2 ms 2224 KB Output is correct
8 Correct 2 ms 2252 KB Output is correct
9 Correct 2 ms 2216 KB Output is correct
10 Correct 3 ms 2252 KB Output is correct
11 Correct 2 ms 2252 KB Output is correct
12 Correct 2 ms 2252 KB Output is correct
13 Correct 2 ms 2252 KB Output is correct
14 Correct 3 ms 2252 KB Output is correct
15 Correct 2 ms 2252 KB Output is correct
16 Correct 3 ms 2252 KB Output is correct
17 Correct 3 ms 2252 KB Output is correct
18 Correct 3 ms 2252 KB Output is correct
19 Correct 3 ms 2252 KB Output is correct
20 Correct 3 ms 2252 KB Output is correct
21 Incorrect 3 ms 2252 KB Output isn't correct
22 Halted 0 ms 0 KB -