Submission #415841

#TimeUsernameProblemLanguageResultExecution timeMemory
415841grtBoat (APIO16_boat)C++17
9 / 100
4 ms332 KiB
#include <bits/stdc++.h> #define ST first #define ND second #define PB push_back using namespace std; using ll = long long; using pi = pair<int,int>; using vi = vector<int>; const int nax = 500 + 10, mod = 1e9 + 7; int n, mx; int dp[nax]; int a[nax], b[nax]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for(int i = 1; i <= n; ++i) { cin >> a[i] >> b[i]; } dp[0] = 1; for(int i = 1; i <= n; ++i) { for(int j = i - 1; j >= 0; --j) { if(a[j] < a[i]) { dp[i] = (dp[i] + dp[j]) % mod; } } } int sum = 0; for(int i = 1; i <= n; ++i) { sum = (sum + dp[i]) % mod; } cout << sum; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...