Submission #795891

#TimeUsernameProblemLanguageResultExecution timeMemory
795891baneBoat (APIO16_boat)C++17
9 / 100
2 ms340 KiB
#include<bits/stdc++.h> using namespace std; const int mod = (int)1e9 + 7; int a[501], b[501]; void solve(){ int n; cin >> n; for (int i = 0; i < n; i++){ cin >> a[i] >> b[i]; } long long dp[n]; long long ans = 0; for (int i = 0; i < n; i++){ dp[i] = 1; for (int j = i - 1; j >= 0; j--){ if (a[i] > a[j])dp[i] += dp[j]; dp[i] %= mod; } ans += dp[i]; ans %= mod; } cout << ans << endl; } int main(){ ios::sync_with_stdio(0); cin.tie(0); 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...