답안 #123945

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
123945 2019-07-02T09:57:56 Z RafikHachana Boat (APIO16_boat) C++14
9 / 100
2000 ms 8388 KB
#include<bits/stdc++.h>
using namespace std;

#define mod (int)(1e9+7)

int n;
vector<int> a,b;
map<pair<int,int>,int> m;

int dp(int i,int val)
{
  //cout<<val<<endl;
  if(i==n) return (int)(val!=-1);
  if(m.find({i,val})!=m.end()) return m[{i,val}];
  int r = dp(i+1,val)%mod;
  for(int j=max(val,a[i]);j<=b[i];j++) r+=(dp(i+1,j+1))%mod;
  return m[{i,val}] = r%mod;
}

int main()
{
  cin>>n;
  a.resize(n);
  b.resize(n);
  for(int i=0;i<n;i++)
  {
    cin>>a[i]>>b[i];
  }
  cout<<dp(0,-1)%mod<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 93 ms 8184 KB Output is correct
2 Correct 88 ms 8184 KB Output is correct
3 Correct 92 ms 8180 KB Output is correct
4 Correct 88 ms 8184 KB Output is correct
5 Correct 91 ms 8184 KB Output is correct
6 Correct 118 ms 8184 KB Output is correct
7 Correct 114 ms 8184 KB Output is correct
8 Correct 118 ms 8352 KB Output is correct
9 Correct 113 ms 8184 KB Output is correct
10 Correct 120 ms 8312 KB Output is correct
11 Correct 115 ms 8184 KB Output is correct
12 Correct 123 ms 8320 KB Output is correct
13 Correct 122 ms 8184 KB Output is correct
14 Correct 116 ms 8184 KB Output is correct
15 Correct 118 ms 8388 KB Output is correct
16 Correct 20 ms 2552 KB Output is correct
17 Correct 22 ms 2936 KB Output is correct
18 Correct 21 ms 2684 KB Output is correct
19 Correct 21 ms 2808 KB Output is correct
20 Correct 20 ms 2680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 93 ms 8184 KB Output is correct
2 Correct 88 ms 8184 KB Output is correct
3 Correct 92 ms 8180 KB Output is correct
4 Correct 88 ms 8184 KB Output is correct
5 Correct 91 ms 8184 KB Output is correct
6 Correct 118 ms 8184 KB Output is correct
7 Correct 114 ms 8184 KB Output is correct
8 Correct 118 ms 8352 KB Output is correct
9 Correct 113 ms 8184 KB Output is correct
10 Correct 120 ms 8312 KB Output is correct
11 Correct 115 ms 8184 KB Output is correct
12 Correct 123 ms 8320 KB Output is correct
13 Correct 122 ms 8184 KB Output is correct
14 Correct 116 ms 8184 KB Output is correct
15 Correct 118 ms 8388 KB Output is correct
16 Correct 20 ms 2552 KB Output is correct
17 Correct 22 ms 2936 KB Output is correct
18 Correct 21 ms 2684 KB Output is correct
19 Correct 21 ms 2808 KB Output is correct
20 Correct 20 ms 2680 KB Output is correct
21 Execution timed out 2064 ms 2028 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 2045 ms 256 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 93 ms 8184 KB Output is correct
2 Correct 88 ms 8184 KB Output is correct
3 Correct 92 ms 8180 KB Output is correct
4 Correct 88 ms 8184 KB Output is correct
5 Correct 91 ms 8184 KB Output is correct
6 Correct 118 ms 8184 KB Output is correct
7 Correct 114 ms 8184 KB Output is correct
8 Correct 118 ms 8352 KB Output is correct
9 Correct 113 ms 8184 KB Output is correct
10 Correct 120 ms 8312 KB Output is correct
11 Correct 115 ms 8184 KB Output is correct
12 Correct 123 ms 8320 KB Output is correct
13 Correct 122 ms 8184 KB Output is correct
14 Correct 116 ms 8184 KB Output is correct
15 Correct 118 ms 8388 KB Output is correct
16 Correct 20 ms 2552 KB Output is correct
17 Correct 22 ms 2936 KB Output is correct
18 Correct 21 ms 2684 KB Output is correct
19 Correct 21 ms 2808 KB Output is correct
20 Correct 20 ms 2680 KB Output is correct
21 Execution timed out 2064 ms 2028 KB Time limit exceeded
22 Halted 0 ms 0 KB -