답안 #320745

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
320745 2020-11-09T17:36:47 Z Everule Discharging (NOI20_discharging) C++14
36 / 100
1000 ms 17124 KB
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
using ll = long long int;
template<typename T>
ostream& operator+(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out<<x<<" ";
    }
    out<<"\n";
    return out;
}
template<typename T>
ostream& operator*(ostream& out, const vector<T> &vec){
    for(const auto &x : vec){
        out+x;
    }
    return out;
}
template<typename T>
istream& operator>>(istream& in, vector<T> &vec){
    for(auto &x : vec){
        in>>x;
    }
    return in;
}
const ll INFLL = 1e18;
void solve(){
    int n;
    cin>>n;
    vector<int> seq(n);
    cin>>seq;
    vector<ll> dp(n + 1, INFLL);
    dp[n] = 0;
    for(int i=n-1;i>=0;--i){
        ll currmx = 0;
        for(int j=i;j<n;j++){
            currmx = max(currmx, ll(seq[j]));
            dp[i] = min(dp[i], currmx*(n-i) + dp[j+1]);
        }
    }
    cout<<dp[0]<<"\n";
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    solve();
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 3 ms 364 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 364 KB Output is correct
10 Correct 3 ms 364 KB Output is correct
11 Correct 3 ms 364 KB Output is correct
12 Correct 3 ms 492 KB Output is correct
13 Correct 3 ms 364 KB Output is correct
14 Correct 3 ms 364 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 364 KB Output is correct
2 Correct 2 ms 364 KB Output is correct
3 Correct 3 ms 364 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 3 ms 364 KB Output is correct
6 Correct 3 ms 364 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
8 Correct 3 ms 376 KB Output is correct
9 Correct 3 ms 364 KB Output is correct
10 Correct 3 ms 364 KB Output is correct
11 Correct 3 ms 364 KB Output is correct
12 Correct 3 ms 492 KB Output is correct
13 Correct 3 ms 364 KB Output is correct
14 Correct 3 ms 364 KB Output is correct
15 Correct 2 ms 364 KB Output is correct
16 Execution timed out 1076 ms 17124 KB Time limit exceeded
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1034 ms 16996 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 3 ms 364 KB Output is correct
16 Correct 2 ms 364 KB Output is correct
17 Correct 3 ms 364 KB Output is correct
18 Correct 2 ms 364 KB Output is correct
19 Correct 3 ms 364 KB Output is correct
20 Correct 3 ms 364 KB Output is correct
21 Correct 3 ms 384 KB Output is correct
22 Correct 3 ms 376 KB Output is correct
23 Correct 3 ms 364 KB Output is correct
24 Correct 3 ms 364 KB Output is correct
25 Correct 3 ms 364 KB Output is correct
26 Correct 3 ms 492 KB Output is correct
27 Correct 3 ms 364 KB Output is correct
28 Correct 3 ms 364 KB Output is correct
29 Correct 2 ms 364 KB Output is correct
30 Correct 3 ms 364 KB Output is correct
31 Correct 3 ms 364 KB Output is correct
32 Correct 2 ms 364 KB Output is correct
33 Correct 3 ms 364 KB Output is correct
34 Correct 3 ms 364 KB Output is correct
35 Correct 3 ms 364 KB Output is correct
36 Correct 3 ms 364 KB Output is correct
37 Correct 3 ms 364 KB Output is correct
38 Correct 3 ms 364 KB Output is correct
39 Correct 3 ms 364 KB Output is correct
40 Correct 3 ms 364 KB Output is correct
41 Correct 4 ms 364 KB Output is correct
42 Correct 3 ms 364 KB Output is correct
43 Correct 3 ms 364 KB Output is correct
44 Correct 3 ms 364 KB Output is correct
45 Correct 3 ms 492 KB Output is correct
46 Correct 2 ms 364 KB Output is correct
47 Correct 4 ms 364 KB Output is correct
48 Correct 2 ms 364 KB Output is correct
49 Correct 3 ms 364 KB Output is correct
50 Correct 2 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 0 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 3 ms 364 KB Output is correct
16 Correct 2 ms 364 KB Output is correct
17 Correct 3 ms 364 KB Output is correct
18 Correct 2 ms 364 KB Output is correct
19 Correct 3 ms 364 KB Output is correct
20 Correct 3 ms 364 KB Output is correct
21 Correct 3 ms 384 KB Output is correct
22 Correct 3 ms 376 KB Output is correct
23 Correct 3 ms 364 KB Output is correct
24 Correct 3 ms 364 KB Output is correct
25 Correct 3 ms 364 KB Output is correct
26 Correct 3 ms 492 KB Output is correct
27 Correct 3 ms 364 KB Output is correct
28 Correct 3 ms 364 KB Output is correct
29 Correct 2 ms 364 KB Output is correct
30 Execution timed out 1076 ms 17124 KB Time limit exceeded
31 Halted 0 ms 0 KB -