# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1166790 | SmuggingSpun | Fireworks (APIO16_fireworks) | C++20 | 0 ms | 328 KiB |
#include<bits/stdc++.h>
#define taskname "B"
using namespace std;
typedef long long ll;
int n, m;
namespace sub1{
void solve(){
vector<int>a(m);
for(int& x : a){
cin >> x >> x;
}
sort(a.begin(), a.end());
int median = a[m >> 1];
ll ans = 0;
for(int& x : a){
ans += abs(x - median);
}
cout << ans;
}
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
if(fopen(taskname".inp", "r")){
freopen(taskname".inp", "r", stdin);
}
cin >> n >> m;
if(n == 1){
sub1::solve();
}
}
컴파일 시 표준 에러 (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... |