Submission #793000

# Submission time Handle Problem Language Result Execution time Memory
793000 2023-07-25T12:17:54 Z WLZ Measures (CEOI22_measures) C++17
24 / 100
1500 ms 3788 KB
#include <bits/stdc++.h>
using namespace std;

const long double eps = 1e-9;

int n, m, d;
vector<int> a, b;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> d;
  a.resize(n); b.resize(m);
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a.begin(), a.end());
  for (int i = 0; i < m; i++) {
    cin >> b[i];
    a.push_back(b[i]);
    sort(a.begin(), a.end());
    long double e = a[0], ans = 0.0;
    for (int j = 1; j < (int) a.size(); j++) {
      long double reach = a[j] + ans;
      if (reach - e > d) {
        if (a[j] > e + d) e = max(e + d, a[j] - ans);
        else e += d;
      } else {
        long double tmp = ans;
        ans += (e + d - reach) / 2;
        e = a[j] + tmp + (e + d - reach) / 2;
      }
    }
    if (abs(ans - floor(ans)) < eps) cout << (long long) floor(ans) << ' ';
    else cout << fixed << setprecision(1) << ans << ' ';
  }
  cout << '\n';
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 117 ms 3780 KB Output is correct
10 Correct 169 ms 3780 KB Output is correct
11 Correct 54 ms 3784 KB Output is correct
12 Correct 178 ms 3788 KB Output is correct
13 Correct 61 ms 3268 KB Output is correct
14 Correct 137 ms 3784 KB Output is correct
15 Correct 107 ms 3140 KB Output is correct
16 Correct 67 ms 3788 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1567 ms 1308 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1567 ms 1308 KB Time limit exceeded
2 Halted 0 ms 0 KB -