Submission #636809

# Submission time Handle Problem Language Result Execution time Memory
636809 2022-08-30T08:56:54 Z lovrot Boat (APIO16_boat) C++11
0 / 100
2 ms 2260 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));
	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));
      |          ~^     ~~~~~~~~
      |           |       |
      |           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 Incorrect 2 ms 2260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2260 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 2260 KB Output isn't correct
2 Halted 0 ms 0 KB -