#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
int A[505], B[505], n;
bool flag[4];
void init(){
cin>>n;
for(int i=0;i<n;i++){
cin>>A[i]>>B[i];
if(A[i]!=B[i]) flag[0]=1;
}
}
void solve0(){
int D[505];
memset(D,0,sizeof(D));
for(int i=0;i<n;i++){
D[i]=1;
for(int j=0;j<i;j++){
if(A[j]<A[i]) D[i]=(D[i]+D[j])%mod;
}
}
int ans=0;
for(int i=0;i<n;i++) ans=(ans+D[i])%mod;
cout<<ans<<endl;
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
init();
if(!flag[0]) solve0();
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2180 KB |
Output is correct |
2 |
Correct |
0 ms |
2180 KB |
Output is correct |
3 |
Correct |
0 ms |
2180 KB |
Output is correct |
4 |
Correct |
0 ms |
2180 KB |
Output is correct |
5 |
Correct |
0 ms |
2180 KB |
Output is correct |
6 |
Correct |
0 ms |
2180 KB |
Output is correct |
7 |
Correct |
0 ms |
2180 KB |
Output is correct |
8 |
Correct |
0 ms |
2180 KB |
Output is correct |
9 |
Correct |
0 ms |
2180 KB |
Output is correct |
10 |
Correct |
0 ms |
2180 KB |
Output is correct |
11 |
Correct |
0 ms |
2180 KB |
Output is correct |
12 |
Correct |
0 ms |
2180 KB |
Output is correct |
13 |
Correct |
0 ms |
2180 KB |
Output is correct |
14 |
Correct |
0 ms |
2180 KB |
Output is correct |
15 |
Correct |
0 ms |
2180 KB |
Output is correct |
16 |
Correct |
0 ms |
2180 KB |
Output is correct |
17 |
Correct |
0 ms |
2180 KB |
Output is correct |
18 |
Correct |
0 ms |
2180 KB |
Output is correct |
19 |
Correct |
0 ms |
2180 KB |
Output is correct |
20 |
Correct |
0 ms |
2180 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2180 KB |
Output is correct |
2 |
Correct |
0 ms |
2180 KB |
Output is correct |
3 |
Correct |
0 ms |
2180 KB |
Output is correct |
4 |
Correct |
0 ms |
2180 KB |
Output is correct |
5 |
Correct |
0 ms |
2180 KB |
Output is correct |
6 |
Correct |
0 ms |
2180 KB |
Output is correct |
7 |
Correct |
0 ms |
2180 KB |
Output is correct |
8 |
Correct |
0 ms |
2180 KB |
Output is correct |
9 |
Correct |
0 ms |
2180 KB |
Output is correct |
10 |
Correct |
0 ms |
2180 KB |
Output is correct |
11 |
Correct |
0 ms |
2180 KB |
Output is correct |
12 |
Correct |
0 ms |
2180 KB |
Output is correct |
13 |
Correct |
0 ms |
2180 KB |
Output is correct |
14 |
Correct |
0 ms |
2180 KB |
Output is correct |
15 |
Correct |
0 ms |
2180 KB |
Output is correct |
16 |
Correct |
0 ms |
2180 KB |
Output is correct |
17 |
Correct |
0 ms |
2180 KB |
Output is correct |
18 |
Correct |
0 ms |
2180 KB |
Output is correct |
19 |
Correct |
0 ms |
2180 KB |
Output is correct |
20 |
Correct |
0 ms |
2180 KB |
Output is correct |
21 |
Incorrect |
0 ms |
2180 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
2180 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2180 KB |
Output is correct |
2 |
Correct |
0 ms |
2180 KB |
Output is correct |
3 |
Correct |
0 ms |
2180 KB |
Output is correct |
4 |
Correct |
0 ms |
2180 KB |
Output is correct |
5 |
Correct |
0 ms |
2180 KB |
Output is correct |
6 |
Correct |
0 ms |
2180 KB |
Output is correct |
7 |
Correct |
0 ms |
2180 KB |
Output is correct |
8 |
Correct |
0 ms |
2180 KB |
Output is correct |
9 |
Correct |
0 ms |
2180 KB |
Output is correct |
10 |
Correct |
0 ms |
2180 KB |
Output is correct |
11 |
Correct |
0 ms |
2180 KB |
Output is correct |
12 |
Correct |
0 ms |
2180 KB |
Output is correct |
13 |
Correct |
0 ms |
2180 KB |
Output is correct |
14 |
Correct |
0 ms |
2180 KB |
Output is correct |
15 |
Correct |
0 ms |
2180 KB |
Output is correct |
16 |
Correct |
0 ms |
2180 KB |
Output is correct |
17 |
Correct |
0 ms |
2180 KB |
Output is correct |
18 |
Correct |
0 ms |
2180 KB |
Output is correct |
19 |
Correct |
0 ms |
2180 KB |
Output is correct |
20 |
Correct |
0 ms |
2180 KB |
Output is correct |
21 |
Incorrect |
0 ms |
2180 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |