Submission #744308

#TimeUsernameProblemLanguageResultExecution timeMemory
744308b00norpFireworks (APIO16_fireworks)C++14
7 / 100
1 ms324 KiB
#include <bits/stdc++.h> using namespace std; #define int long long mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count()); void Solve() { int n, m; cin >> n >> m; vector<int> wts; for(int i = 2; i <= n + m; i++) { int par, wt; cin >> par >> wt; wts.push_back(wt); } sort(wts.begin(), wts.end()); int idx = wts.size() / 2, ans = 0; for(int i = 0; i < wts.size(); i++) { ans += abs(wts[i] - wts[idx]); } cout << ans << "\n"; } int32_t main() { auto begin = std::chrono::high_resolution_clock::now(); ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; // cin >> t; for(int i = 1; i <= t; i++) { //cout << "Case #" << i << ": "; Solve(); } auto end = std::chrono::high_resolution_clock::now(); auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin); //cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n"; return 0; }

Compilation message (stderr)

fireworks.cpp: In function 'void Solve()':
fireworks.cpp:20:19: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |  for(int i = 0; i < wts.size(); i++)
      |                 ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...