# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
338098 | Dilshod_Imomov | K blocks (IZhO14_blocks) | C++17 | 217 ms | 81516 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
# include <bits/stdc++.h>
# define speed ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
# define int long long
# define fi first
# define se second
using namespace std;
const int N = 1e5 + 7;
const int mod = 1e9 + 7;
int a[N], dp[105][N];
int32_t main() {
speed;
int n, k;
cin >> n >> k;
for ( int i = 1; i <= n; i++ ) {
cin >> a[i];
}
for ( int i = 1; i <= n; i++ ) {
dp[0][i] = 1e9;
}
stack < pair < int, int > > st;
for ( int i = 1; i <= k; i++ ) {
while ( !st.empty() ) {
st.pop();
}
dp[i][i] = dp[i - 1][i - 1] + a[i];
st.push( { a[i], dp[i - 1][i - 1] } );
# | 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... |