제출 #978208

#제출 시각아이디문제언어결과실행 시간메모리
978208AmrBoat (APIO16_boat)C++17
9 / 100
3 ms2396 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; #define S second #define F first #define all(x) (x).begin(),(x).end() #define sz size() #define Yes cout << "YES" << endl #define No cout << "NO" << endl #define pb(x) push_back(x); #define endl '\n' #define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); const int N=502; ll INF=INT_MAX,mod=1e9+7; int TT=1; ll power(ll x, unsigned int y) { ll res = 1; x = x; // % mod; if (x == 0) return 0; while (y > 0) { if (y & 1) res = (res*x) ; // % mod; y = y>>1; x = (x*x) ; // % mod; } return res; } ll n; ll a[N]; ll dp[N][N]; map<ll,ll> mp; void solve() { cin >> n; for(int i = 1; i <= n; i++) cin >> a[i] >> a[i]; for(int i = 1; i <= n; i++) mp[a[i]] = 1; ll coml = 1; for(auto it:mp) { mp[it.F] = coml++; } dp[0][0] = 1; for(int i = 1; i <= n; i++) { ll x = mp[a[i]]; for(int j = 0; j <= n; j++) dp[i][j] = dp[i-1][j]; for(int j = 0; j < x; j++) { dp[i][x] = (dp[i-1][j] + dp[i][x])%mod; } } ll ans = 0; for(int i = 1; i <= n; i++) ans = (ans+dp[n][i])%mod; cout << ans << endl; } int main(){ //freopen("friday.in","r",stdin); //freopen("friday.out","w",stdout); fast; while(TT--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...