Submission #47586

#TimeUsernameProblemLanguageResultExecution timeMemory
47586marvenleeBoat (APIO16_boat)C++14
0 / 100
2 ms376 KiB
#include <iostream> using namespace std; int main() { int n; cin >> n; int increase=1; int dp[n]; int a[n]; int b[n]; for(int i=0;i<n;i++) cin >> a[i] >> b[i]; dp[0]=1; for(int i=1;i<n;i++) { if(a[i]>a[i-1]) { increase += increase+1; dp[i] = 2*dp[i-1] +1; } else { dp[i] = dp[i-1]+increase; } } cout << dp[n-1]; 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...