Submission #719686

# Submission time Handle Problem Language Result Execution time Memory
719686 2023-04-06T13:40:44 Z peijar Measures (CEOI22_measures) C++17
0 / 100
1500 ms 356 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

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 << T / 2. << ' ';
  }
  cout << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 24 ms 340 KB Output is correct
2 Incorrect 23 ms 356 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 340 KB Output is correct
2 Incorrect 23 ms 356 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1554 ms 324 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1554 ms 324 KB Time limit exceeded
2 Halted 0 ms 0 KB -