# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
105767 | 2019-04-14T10:33:34 Z | Pro_ktmr | Boat (APIO16_boat) | C++14 | 2000 ms | 525312 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[505], b[505]; vector<int> zaatu; int dp[2][1000505]; 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]); for(int j=a[i]; j<b[i]; j++) zaatu.PB(j); } zaatu.PB(0); zaatu.PB(INT_MAX); sort(zaatu.begin(), zaatu.end()); zaatu.erase(unique(zaatu.begin(), zaatu.end()), zaatu.end()); for(int i=0; i<zaatu.size(); i++){ dp[N%2][i] = 1; } for(int i=N-1; i>=0; i--){ LL tmp = 0; for(int j=zaatu.size()-2; j>=0; j--){ LL ans = dp[(i+1)%2][j]; if(a[i] <= zaatu[j+1] && zaatu[j+1] < b[i]) tmp += dp[(i+1)%2][j+1]; tmp %= MOD; dp[i%2][j] = (ans + tmp) % MOD; } } cout << dp[0][0] - 1 << endl; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 384 KB | Output is correct |
10 | Correct | 4 ms | 384 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 4 ms | 384 KB | Output is correct |
14 | Correct | 4 ms | 384 KB | Output is correct |
15 | Correct | 4 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 384 KB | Output is correct |
17 | Correct | 3 ms | 384 KB | Output is correct |
18 | Correct | 3 ms | 384 KB | Output is correct |
19 | Correct | 3 ms | 384 KB | Output is correct |
20 | Correct | 3 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 384 KB | Output is correct |
10 | Correct | 4 ms | 384 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 4 ms | 384 KB | Output is correct |
14 | Correct | 4 ms | 384 KB | Output is correct |
15 | Correct | 4 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 384 KB | Output is correct |
17 | Correct | 3 ms | 384 KB | Output is correct |
18 | Correct | 3 ms | 384 KB | Output is correct |
19 | Correct | 3 ms | 384 KB | Output is correct |
20 | Correct | 3 ms | 384 KB | Output is correct |
21 | Correct | 56 ms | 4592 KB | Output is correct |
22 | Correct | 66 ms | 4592 KB | Output is correct |
23 | Correct | 54 ms | 4592 KB | Output is correct |
24 | Correct | 57 ms | 4720 KB | Output is correct |
25 | Correct | 72 ms | 4656 KB | Output is correct |
26 | Correct | 69 ms | 4592 KB | Output is correct |
27 | Correct | 56 ms | 4592 KB | Output is correct |
28 | Correct | 57 ms | 4592 KB | Output is correct |
29 | Correct | 53 ms | 4592 KB | Output is correct |
30 | Execution timed out | 2060 ms | 12108 KB | Time limit exceeded |
31 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 902 ms | 525312 KB | Execution killed with signal 9 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | Output is correct |
2 | Correct | 4 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 4 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 3 ms | 384 KB | Output is correct |
9 | Correct | 4 ms | 384 KB | Output is correct |
10 | Correct | 4 ms | 384 KB | Output is correct |
11 | Correct | 4 ms | 384 KB | Output is correct |
12 | Correct | 3 ms | 384 KB | Output is correct |
13 | Correct | 4 ms | 384 KB | Output is correct |
14 | Correct | 4 ms | 384 KB | Output is correct |
15 | Correct | 4 ms | 384 KB | Output is correct |
16 | Correct | 3 ms | 384 KB | Output is correct |
17 | Correct | 3 ms | 384 KB | Output is correct |
18 | Correct | 3 ms | 384 KB | Output is correct |
19 | Correct | 3 ms | 384 KB | Output is correct |
20 | Correct | 3 ms | 384 KB | Output is correct |
21 | Correct | 56 ms | 4592 KB | Output is correct |
22 | Correct | 66 ms | 4592 KB | Output is correct |
23 | Correct | 54 ms | 4592 KB | Output is correct |
24 | Correct | 57 ms | 4720 KB | Output is correct |
25 | Correct | 72 ms | 4656 KB | Output is correct |
26 | Correct | 69 ms | 4592 KB | Output is correct |
27 | Correct | 56 ms | 4592 KB | Output is correct |
28 | Correct | 57 ms | 4592 KB | Output is correct |
29 | Correct | 53 ms | 4592 KB | Output is correct |
30 | Execution timed out | 2060 ms | 12108 KB | Time limit exceeded |
31 | Halted | 0 ms | 0 KB | - |