# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
105722 | 2019-04-14T05:55:36 Z | Pro_ktmr | Boat (APIO16_boat) | C++14 | 16 ms | 4268 KB |
#include"bits/stdc++.h" using namespace std; #define LL long long #define REP(i, n) for(int (i)=0; (i)<(n); (i)++) #define PB push_back #define MP make_pair #define MOD 1000000007 int N; int a[500],b[500]; vector<int> zaatu; LL dp[500][1001] = {}; LL solve(int now, int bef){ if(now == N) return 1LL; if(dp[now][bef] != 0) return dp[now][bef]; LL ans = solve(now+1,bef); if(zaatu[bef] < a[now]) ans += solve(now+1,lower_bound(zaatu.begin(), zaatu.end(), a[now])-zaatu.begin()); return dp[now][bef] = ans % MOD; } int main(){ scanf("%d", &N); for(int i=0; i<N; i++){ scanf("%d%d", a+i, b+i); b[i]++; zaatu.PB(a[i]); zaatu.PB(b[i]); } zaatu.PB(0); sort(zaatu.begin(), zaatu.end()); cout << solve(0, 0) - 1 << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 4224 KB | Output is correct |
2 | Correct | 15 ms | 4216 KB | Output is correct |
3 | Correct | 15 ms | 4268 KB | Output is correct |
4 | Correct | 15 ms | 4224 KB | Output is correct |
5 | Correct | 12 ms | 4224 KB | Output is correct |
6 | Correct | 15 ms | 4088 KB | Output is correct |
7 | Correct | 12 ms | 4096 KB | Output is correct |
8 | Correct | 14 ms | 4096 KB | Output is correct |
9 | Correct | 15 ms | 4172 KB | Output is correct |
10 | Correct | 16 ms | 4224 KB | Output is correct |
11 | Correct | 13 ms | 4096 KB | Output is correct |
12 | Correct | 11 ms | 4224 KB | Output is correct |
13 | Correct | 11 ms | 4096 KB | Output is correct |
14 | Correct | 12 ms | 4224 KB | Output is correct |
15 | Correct | 12 ms | 4096 KB | Output is correct |
16 | Correct | 10 ms | 4224 KB | Output is correct |
17 | Correct | 8 ms | 4224 KB | Output is correct |
18 | Correct | 8 ms | 4224 KB | Output is correct |
19 | Correct | 8 ms | 4224 KB | Output is correct |
20 | Correct | 8 ms | 4224 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 4224 KB | Output is correct |
2 | Correct | 15 ms | 4216 KB | Output is correct |
3 | Correct | 15 ms | 4268 KB | Output is correct |
4 | Correct | 15 ms | 4224 KB | Output is correct |
5 | Correct | 12 ms | 4224 KB | Output is correct |
6 | Correct | 15 ms | 4088 KB | Output is correct |
7 | Correct | 12 ms | 4096 KB | Output is correct |
8 | Correct | 14 ms | 4096 KB | Output is correct |
9 | Correct | 15 ms | 4172 KB | Output is correct |
10 | Correct | 16 ms | 4224 KB | Output is correct |
11 | Correct | 13 ms | 4096 KB | Output is correct |
12 | Correct | 11 ms | 4224 KB | Output is correct |
13 | Correct | 11 ms | 4096 KB | Output is correct |
14 | Correct | 12 ms | 4224 KB | Output is correct |
15 | Correct | 12 ms | 4096 KB | Output is correct |
16 | Correct | 10 ms | 4224 KB | Output is correct |
17 | Correct | 8 ms | 4224 KB | Output is correct |
18 | Correct | 8 ms | 4224 KB | Output is correct |
19 | Correct | 8 ms | 4224 KB | Output is correct |
20 | Correct | 8 ms | 4224 KB | Output is correct |
21 | Incorrect | 13 ms | 4224 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 896 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 14 ms | 4224 KB | Output is correct |
2 | Correct | 15 ms | 4216 KB | Output is correct |
3 | Correct | 15 ms | 4268 KB | Output is correct |
4 | Correct | 15 ms | 4224 KB | Output is correct |
5 | Correct | 12 ms | 4224 KB | Output is correct |
6 | Correct | 15 ms | 4088 KB | Output is correct |
7 | Correct | 12 ms | 4096 KB | Output is correct |
8 | Correct | 14 ms | 4096 KB | Output is correct |
9 | Correct | 15 ms | 4172 KB | Output is correct |
10 | Correct | 16 ms | 4224 KB | Output is correct |
11 | Correct | 13 ms | 4096 KB | Output is correct |
12 | Correct | 11 ms | 4224 KB | Output is correct |
13 | Correct | 11 ms | 4096 KB | Output is correct |
14 | Correct | 12 ms | 4224 KB | Output is correct |
15 | Correct | 12 ms | 4096 KB | Output is correct |
16 | Correct | 10 ms | 4224 KB | Output is correct |
17 | Correct | 8 ms | 4224 KB | Output is correct |
18 | Correct | 8 ms | 4224 KB | Output is correct |
19 | Correct | 8 ms | 4224 KB | Output is correct |
20 | Correct | 8 ms | 4224 KB | Output is correct |
21 | Incorrect | 13 ms | 4224 KB | Output isn't correct |
22 | Halted | 0 ms | 0 KB | - |