답안 #44498

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
44498 2018-04-02T15:14:15 Z arman_ferdous Boat (APIO16_boat) C++17
9 / 100
6 ms 1996 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 510, inf = 2e9, mod = 1e9+7;
int n;
pair<int,int> arr[510];

int dp[510][510];
int dp_9pts(int pos, int prev) {
	if(pos < 0) return 1;
	if(dp[pos][prev] != -1) return dp[pos][prev];
	
	int ret = dp_9pts(pos-1,prev) % mod;
	if(arr[pos].first < arr[prev].first) ret = (ret + dp_9pts(pos-1,pos))%mod;
	return dp[pos][prev] = ret;
}

void pts9() {
	memset(dp,-1,sizeof dp);
	arr[n].first = inf;
	printf("%d\n", dp_9pts(n-1,n) - 1);
}

int main() {
	scanf("%d", &n);
	for(int i = 0; i < n; i++)
		scanf("%d %d", &arr[i].first, &arr[i].second);
	pts9();
	return 0;
}

Compilation message

boat.cpp: In function 'int main()':
boat.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
boat.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &arr[i].first, &arr[i].second);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1400 KB Output is correct
2 Correct 5 ms 1400 KB Output is correct
3 Correct 6 ms 1476 KB Output is correct
4 Correct 6 ms 1504 KB Output is correct
5 Correct 5 ms 1504 KB Output is correct
6 Correct 5 ms 1592 KB Output is correct
7 Correct 5 ms 1592 KB Output is correct
8 Correct 6 ms 1668 KB Output is correct
9 Correct 5 ms 1680 KB Output is correct
10 Correct 5 ms 1820 KB Output is correct
11 Correct 6 ms 1820 KB Output is correct
12 Correct 6 ms 1916 KB Output is correct
13 Correct 5 ms 1916 KB Output is correct
14 Correct 5 ms 1916 KB Output is correct
15 Correct 5 ms 1916 KB Output is correct
16 Correct 5 ms 1916 KB Output is correct
17 Correct 5 ms 1916 KB Output is correct
18 Correct 5 ms 1964 KB Output is correct
19 Correct 6 ms 1968 KB Output is correct
20 Correct 6 ms 1980 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1400 KB Output is correct
2 Correct 5 ms 1400 KB Output is correct
3 Correct 6 ms 1476 KB Output is correct
4 Correct 6 ms 1504 KB Output is correct
5 Correct 5 ms 1504 KB Output is correct
6 Correct 5 ms 1592 KB Output is correct
7 Correct 5 ms 1592 KB Output is correct
8 Correct 6 ms 1668 KB Output is correct
9 Correct 5 ms 1680 KB Output is correct
10 Correct 5 ms 1820 KB Output is correct
11 Correct 6 ms 1820 KB Output is correct
12 Correct 6 ms 1916 KB Output is correct
13 Correct 5 ms 1916 KB Output is correct
14 Correct 5 ms 1916 KB Output is correct
15 Correct 5 ms 1916 KB Output is correct
16 Correct 5 ms 1916 KB Output is correct
17 Correct 5 ms 1916 KB Output is correct
18 Correct 5 ms 1964 KB Output is correct
19 Correct 6 ms 1968 KB Output is correct
20 Correct 6 ms 1980 KB Output is correct
21 Incorrect 6 ms 1992 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1996 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1400 KB Output is correct
2 Correct 5 ms 1400 KB Output is correct
3 Correct 6 ms 1476 KB Output is correct
4 Correct 6 ms 1504 KB Output is correct
5 Correct 5 ms 1504 KB Output is correct
6 Correct 5 ms 1592 KB Output is correct
7 Correct 5 ms 1592 KB Output is correct
8 Correct 6 ms 1668 KB Output is correct
9 Correct 5 ms 1680 KB Output is correct
10 Correct 5 ms 1820 KB Output is correct
11 Correct 6 ms 1820 KB Output is correct
12 Correct 6 ms 1916 KB Output is correct
13 Correct 5 ms 1916 KB Output is correct
14 Correct 5 ms 1916 KB Output is correct
15 Correct 5 ms 1916 KB Output is correct
16 Correct 5 ms 1916 KB Output is correct
17 Correct 5 ms 1916 KB Output is correct
18 Correct 5 ms 1964 KB Output is correct
19 Correct 6 ms 1968 KB Output is correct
20 Correct 6 ms 1980 KB Output is correct
21 Incorrect 6 ms 1992 KB Output isn't correct
22 Halted 0 ms 0 KB -