Submission #683316

#TimeUsernameProblemLanguageResultExecution timeMemory
683316nutellaMeasures (CEOI22_measures)C++17
0 / 100
19 ms2016 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m, D; cin >> n >> m >> D; vector<int> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } vector<int> b(m); for (int i = 0; i < m; ++i) { cin >> b[i]; } if (n > 0) { sort(a.begin(), a.end()); for (int i = 0; i < m; ++i) { a.insert(lower_bound(a.begin(), a.end(), b[i]), b[i]); ll ans = numeric_limits<ll>::min(); for (int j = 0; j < size(a); ++j) { ans = max(ans, 1LL * D * j - a[j]); } ans += a[0]; if (ans % 2 == 0) { cout << ans / 2 << ' '; } else { cout << ans / 2 << ".5 "; } } } else { assert(false); } return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:30:31: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |             for (int j = 0; j < size(a); ++j) {
      |                             ~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...