# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
623705 | Ferid20072020 | Autići (COCI22_autici) | C++14 | 16 ms | 1624 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define f first
#define s second
#define ins insert
#define pb push_back
#define MOD 10000
#define oo 1000000001
#define pii pair<int , int>
#define pll pair<ll , ll>
#define pli pair<ll , int>
#define pil pair<int , ll>
int a[100001];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n , x , x1;
ll min1 = oo , min2 = oo;
cin >> n;
if(n == 1){
cout << 0;
return 0;
}
for(int i=1 ; i<=n ; i++){
cin >> a[i];
if(min1 > a[i]){
min1 = a[i];
x = i;
}
}
for(int i=1 ; i<=n ; i++){
if(min2 > a[i] && i != x){
min2 = a[i];
x1 = i;
}
}
ll cem = min1 + min2;
for(int i=1 ; i<=n ; i++){
if(i != x && i != x1){
cem += a[i] + min1;
}
}
cout << cem;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |