# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
21834 | 2017-04-26T09:09:10 Z | mohammad_kilani | Boat (APIO16_boat) | C++14 | 2000 ms | 524288 KB |
#include <bits/stdc++.h> using namespace std; #define Mod 1000000007 int n; int l[1000]; int r[1001]; vector<vector<int> > sum; int main() { scanf("%d",&n); int ans = 0 ; sum.resize(n+1); for(int i=0;i<n;i++){ scanf("%d%d",&l[i],&r[i]); for(int k=l[i];k<=r[i];k++){ int cur = 1; for(int j=0;j<i;j++){ if(k <= l[j]) continue; int num = min(r[j]+1,k) - l[j] - 1; cur+=sum[j][num]; if(cur >= Mod) cur-=Mod; } sum[i].push_back(cur); if(k != l[i]) sum[i][k-l[i]]+=sum[i][k-l[i]-1]; ans+=cur; if(ans >= Mod) ans-=Mod; } } printf("%d\n",ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2028 KB | Output is correct |
2 | Correct | 0 ms | 2028 KB | Output is correct |
3 | Correct | 0 ms | 2028 KB | Output is correct |
4 | Correct | 0 ms | 2028 KB | Output is correct |
5 | Correct | 0 ms | 2028 KB | Output is correct |
6 | Correct | 0 ms | 2028 KB | Output is correct |
7 | Correct | 0 ms | 2028 KB | Output is correct |
8 | Correct | 0 ms | 2028 KB | Output is correct |
9 | Correct | 0 ms | 2028 KB | Output is correct |
10 | Correct | 0 ms | 2028 KB | Output is correct |
11 | Correct | 0 ms | 2028 KB | Output is correct |
12 | Correct | 0 ms | 2028 KB | Output is correct |
13 | Correct | 0 ms | 2028 KB | Output is correct |
14 | Correct | 0 ms | 2028 KB | Output is correct |
15 | Correct | 0 ms | 2028 KB | Output is correct |
16 | Correct | 0 ms | 2028 KB | Output is correct |
17 | Correct | 0 ms | 2028 KB | Output is correct |
18 | Correct | 0 ms | 2028 KB | Output is correct |
19 | Correct | 0 ms | 2028 KB | Output is correct |
20 | Correct | 0 ms | 2028 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2028 KB | Output is correct |
2 | Correct | 0 ms | 2028 KB | Output is correct |
3 | Correct | 0 ms | 2028 KB | Output is correct |
4 | Correct | 0 ms | 2028 KB | Output is correct |
5 | Correct | 0 ms | 2028 KB | Output is correct |
6 | Correct | 0 ms | 2028 KB | Output is correct |
7 | Correct | 0 ms | 2028 KB | Output is correct |
8 | Correct | 0 ms | 2028 KB | Output is correct |
9 | Correct | 0 ms | 2028 KB | Output is correct |
10 | Correct | 0 ms | 2028 KB | Output is correct |
11 | Correct | 0 ms | 2028 KB | Output is correct |
12 | Correct | 0 ms | 2028 KB | Output is correct |
13 | Correct | 0 ms | 2028 KB | Output is correct |
14 | Correct | 0 ms | 2028 KB | Output is correct |
15 | Correct | 0 ms | 2028 KB | Output is correct |
16 | Correct | 0 ms | 2028 KB | Output is correct |
17 | Correct | 0 ms | 2028 KB | Output is correct |
18 | Correct | 0 ms | 2028 KB | Output is correct |
19 | Correct | 0 ms | 2028 KB | Output is correct |
20 | Correct | 0 ms | 2028 KB | Output is correct |
21 | Execution timed out | 2000 ms | 7084 KB | Execution timed out |
22 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Memory limit exceeded | 403 ms | 524288 KB | Memory limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2028 KB | Output is correct |
2 | Correct | 0 ms | 2028 KB | Output is correct |
3 | Correct | 0 ms | 2028 KB | Output is correct |
4 | Correct | 0 ms | 2028 KB | Output is correct |
5 | Correct | 0 ms | 2028 KB | Output is correct |
6 | Correct | 0 ms | 2028 KB | Output is correct |
7 | Correct | 0 ms | 2028 KB | Output is correct |
8 | Correct | 0 ms | 2028 KB | Output is correct |
9 | Correct | 0 ms | 2028 KB | Output is correct |
10 | Correct | 0 ms | 2028 KB | Output is correct |
11 | Correct | 0 ms | 2028 KB | Output is correct |
12 | Correct | 0 ms | 2028 KB | Output is correct |
13 | Correct | 0 ms | 2028 KB | Output is correct |
14 | Correct | 0 ms | 2028 KB | Output is correct |
15 | Correct | 0 ms | 2028 KB | Output is correct |
16 | Correct | 0 ms | 2028 KB | Output is correct |
17 | Correct | 0 ms | 2028 KB | Output is correct |
18 | Correct | 0 ms | 2028 KB | Output is correct |
19 | Correct | 0 ms | 2028 KB | Output is correct |
20 | Correct | 0 ms | 2028 KB | Output is correct |
21 | Execution timed out | 2000 ms | 7084 KB | Execution timed out |
22 | Halted | 0 ms | 0 KB | - |