# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
38740 | 2018-01-06T11:21:46 Z | bakurits | Boat (APIO16_boat) | C++14 | 0 ms | 2408 KB |
#include <iostream> #include <stdio.h> const int N = 510; const int BIG_N = 1e5; const int rem = 1e9 + 7; using namespace std; int n; int A[N], B[N]; int dp[BIG_N]; void print() { for (int i = 1; i < BIG_N; i++) { printf("%d ", dp[i]); } puts(""); } int main() { scanf ("%d", &n); for (int i = 1; i <= n; i++) { scanf("%d %d", &A[i], &B[i]); } dp[0] = 1; for (int i = 1; i <= n; i++) { int sum = 0; for (int j = 0; j < A[i]; j++) { sum = (sum + dp[j]) % rem; } for (int j = A[i]; j <= B[i]; j++) { int sm = dp[j]; dp[j] = (dp[j] + sum) % rem; sum = (sum + sm) % rem; } // print(); } int ans = 0; for (int i = 1; i < BIG_N; i++) { ans = (ans + dp[i]) % rem; } printf("%d", ans); }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 2408 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 2408 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 2408 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 2408 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |