Submission #570253

# Submission time Handle Problem Language Result Execution time Memory
570253 2022-05-28T22:00:16 Z thatsgonzalez Discharging (NOI20_discharging) C++14
0 / 100
104 ms 8304 KB
#include <bits/stdc++.h>
using namespace std;
int main(){
    // The following line disables syncing between cin/scanf and cout/printf.
    // It makes input faster, but you must not use functions from <cstdio> (e.g. scanf/printf) directly.
    // This line must be executed before any use of cin/cout.
    ios_base::sync_with_stdio(false);

    // Your code goes here ...
    // (You can now read input and write output normally using cin/cout.)
    int N;
    cin >> N;

    int a[N]; for(auto &x: a) cin>>x;
    long long ans=LLONG_MAX;
    for(int i=0; i<(1<<3); i++){
        vector <long long> c,b;
        for(int j=0; j<N; j++){
            if(j&i){
                c.push_back(a[j]);
            }
            else{
                b.push_back(b[j]);
            }
        }
        long long res1 = (long long)(c.size())*(*max_element(c.begin(),c.end()));
        long long res2 = (long long)(b.size())*(*max_element(b.begin(),b.end()));
        ans=min(ans,res1+res2);
    }
    cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 104 ms 8304 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 340 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -