# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
570250 | thatsgonzalez | Discharging (NOI20_discharging) | C++14 | 103 ms | 8304 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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<<endl;
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |