Submission #719688

# Submission time Handle Problem Language Result Execution time Memory
719688 2023-04-06T13:42:15 Z peijar Measures (CEOI22_measures) C++17
10 / 100
1500 ms 3008 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

string to_string(string s) { return s; }
template <typename T> string to_string(T v) {
  bool first = true;
  string res = "[";
  for (const auto &x : v) {
    if (!first)
      res += ", ";
    first = false;
    res += to_string(x);
  }
  res += "]";
  return res;
}

void dbg_out() { cout << endl; }
template <typename Head, typename... Tail> void dbg_out(Head H, Tail... T) {
  cout << ' ' << to_string(H);
  dbg_out(T...);
}

#ifdef DEBUG
#define dbg(...) cout << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif

string affiche(int x) {
  if (x % 2)
    return to_string(x / 2) + ".5";
  return to_string(x / 2);
}

signed main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int nbPersonnes, nbRequetes, D;
  cin >> nbPersonnes >> nbRequetes >> D;

  vector<int> values;
  for (int i = 0; i < nbPersonnes; ++i) {
    int x;
    cin >> x;
    values.push_back(x);
  }

  for (int i = 0; i < nbRequetes; ++i) {
    int x;
    cin >> x;
    values.push_back(x);
    sort(values.begin(), values.end());

    int T = 0;
    for (int u = 0; u < (int)values.size(); ++u)
      for (int v = u + 1; v < (int)values.size(); ++v)
        T = max(T, D * v - values[v] - (D * u - values[u]));
    cout << affiche(T) << ' ';
  }
  cout << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 23 ms 340 KB Output is correct
2 Correct 23 ms 356 KB Output is correct
3 Correct 23 ms 328 KB Output is correct
4 Correct 23 ms 340 KB Output is correct
5 Correct 21 ms 372 KB Output is correct
6 Correct 23 ms 468 KB Output is correct
7 Correct 25 ms 352 KB Output is correct
8 Correct 24 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 23 ms 340 KB Output is correct
2 Correct 23 ms 356 KB Output is correct
3 Correct 23 ms 328 KB Output is correct
4 Correct 23 ms 340 KB Output is correct
5 Correct 21 ms 372 KB Output is correct
6 Correct 23 ms 468 KB Output is correct
7 Correct 25 ms 352 KB Output is correct
8 Correct 24 ms 340 KB Output is correct
9 Execution timed out 1551 ms 3008 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1554 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1554 ms 348 KB Time limit exceeded
2 Halted 0 ms 0 KB -