이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
// #pragma GCC target( "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
// #pragma GCC optimize("Ofast,unroll-loops,fast-math,O3")
#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define sz(x) (int)x.size()
#define bit(a, i) ((a>>i)&1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int K = 800;
const ll inf = 1e18;
const int mod = 1e9 + 7;
const int maxn = 3e5 + 100;
int n;
int a[maxn];
int b[maxn];
int dp[maxn];
void IHTW(){
cin >> n;
int ans = 0;
for(int i=1; i<=n; i++){
cin >> a[i] >> b[i];
dp[i] = 1;
for(int j=1; j<i; j++){
if(a[j] < a[i]) dp[i] = (dp[j] + dp[i]) % mod;
}
ans = (ans + dp[i]) % mod;
}
cout << ans;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t=1;
while(t--) IHTW();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |