제출 #433566

#제출 시각아이디문제언어결과실행 시간메모리
433566JeanBombeurBoat (APIO16_boat)C++17
9 / 100
4 ms2252 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...