# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
40039 | 2018-01-25T16:47:43 Z | fest | Fireworks (APIO16_fireworks) | C++14 | 0 ms | 2996 KB |
// fest #include <bits/stdc++.h> #define pb push_back #define F first #define S second #define y1 dasdasfasfas #define x1 wqdadfasfasfas #define All(c) c.begin(), c.end() #define SZ(A) (int((A).size())) #define umap unordered_map #define FILENAME "" #define __ fflush(stdout) typedef long long ll; typedef long double ld; using namespace std; void FREOPEN() { #ifdef COMP freopen(".in", "r", stdin); freopen("2.out", "w", stdout); #else freopen(FILENAME".in", "r", stdin); freopen(FILENAME".out", "w", stdout); #endif } inline double Time() {return (clock() * 1.0) / CLOCKS_PER_SEC; } const int N = 200500, inf = 1e9 * 2, MOD = (int)1e9 + 7; char CH[N]; const ll INF = 1e18; const int dx[] = {1, -1, 0, 0, -1, 1, -1, 1}; const int dy[] = {0, 0, 1, -1, -1, 1, 1, -1}; int p[N]; int main() { int n, m; cin >> n >> m; for (int i = 1; i <= m; i++) { int x; cin >> x >> p[i]; } sort(p + 1, p + 1 + m); int mid = (m + 1) / 2; ll ans = 0; for (int i = 1; i <= m; i++) { ans += abs(p[i] - p[mid]); } cout << ans; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2996 KB | Output is correct |
2 | Correct | 0 ms | 2996 KB | Output is correct |
3 | Correct | 0 ms | 2996 KB | Output is correct |
4 | Correct | 0 ms | 2996 KB | Output is correct |
5 | Correct | 0 ms | 2996 KB | Output is correct |
6 | Correct | 0 ms | 2996 KB | Output is correct |
7 | Correct | 0 ms | 2996 KB | Output is correct |
8 | Correct | 0 ms | 2996 KB | Output is correct |
9 | Correct | 0 ms | 2996 KB | Output is correct |
10 | Correct | 0 ms | 2996 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2996 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2996 KB | Output is correct |
2 | Correct | 0 ms | 2996 KB | Output is correct |
3 | Correct | 0 ms | 2996 KB | Output is correct |
4 | Correct | 0 ms | 2996 KB | Output is correct |
5 | Correct | 0 ms | 2996 KB | Output is correct |
6 | Correct | 0 ms | 2996 KB | Output is correct |
7 | Correct | 0 ms | 2996 KB | Output is correct |
8 | Correct | 0 ms | 2996 KB | Output is correct |
9 | Correct | 0 ms | 2996 KB | Output is correct |
10 | Correct | 0 ms | 2996 KB | Output is correct |
11 | Incorrect | 0 ms | 2996 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 2996 KB | Output is correct |
2 | Correct | 0 ms | 2996 KB | Output is correct |
3 | Correct | 0 ms | 2996 KB | Output is correct |
4 | Correct | 0 ms | 2996 KB | Output is correct |
5 | Correct | 0 ms | 2996 KB | Output is correct |
6 | Correct | 0 ms | 2996 KB | Output is correct |
7 | Correct | 0 ms | 2996 KB | Output is correct |
8 | Correct | 0 ms | 2996 KB | Output is correct |
9 | Correct | 0 ms | 2996 KB | Output is correct |
10 | Correct | 0 ms | 2996 KB | Output is correct |
11 | Incorrect | 0 ms | 2996 KB | Output isn't correct |
12 | Halted | 0 ms | 0 KB | - |