| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 40854 | IvanC | Fireworks (APIO16_fireworks) | C++14 | 2 ms | 560 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN = 200;
ll N,M,cost;
vector<ll> ordenado;
ll tenta(ll custo){
ll tot = 0;
for(ll val : ordenado) tot += abs(val - custo);
return tot;
}
int main(){
cin >> N >> M;
for(ll i = 2;i<=N+M;i++){
ll p,c;
cin >> p >> c;
if(p == 1){
ordenado.push_back(c);
}
else{
cost += c;
}
}
ll best = tenta(ordenado[0]);
for(ll i = 1;i<=ordenado.size();i++) best = min(best, tenta(ordenado[i]) );
cout << cost + best << endl;
return 0;
}
컴파일 시 표준 에러 (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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
