Submission #1027671

#TimeUsernameProblemLanguageResultExecution timeMemory
1027671Halym2007Fireworks (APIO16_fireworks)C++17
7 / 100
1 ms440 KiB
#include <bits/stdc++.h> using namespace std; #define ff first #define ss second #define pb push_back #define sz size() #define ll long long const int N = 5e2 + 5; ll a[N], n, md = 1e9 + 7, dp[N][2]; int main () { int n, m; cin >> n >> m; for (int i = 1; i <= m; ++i) { int l, r; cin >> l >> r; a[i] = r; } sort (a + 1,a + m + 1); ll sum = 0; for (int i = 1; i <= m; ++i) { sum += abs (a[(m + 1) / 2] - a[i]); } cout << sum; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...