Submission #624404

# Submission time Handle Problem Language Result Execution time Memory
624404 2022-08-08T07:35:37 Z dnx04 Distributing Candies (IOI21_candies) C++17
0 / 100
5000 ms 9692 KB
#include "candies.h"

#include "bits/extc++.h"

using namespace std;

using Query = tuple<int, int, int>;

vector<int> sub1(const vector<int>& c, const vector<Query>& q) {
  vector<int> a(c.size());
  for (auto [l, r, v] : q) {
    for (int i = l; i <= r; ++i) {
      a[i] += v;
      if (a[i] < 0) a[i] = 0;
      if (a[i] > c[i]) a[i] = c[i];
    }
  }
  return a;
}

vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r,
                               vector<int> v) {
  int n = c.size();
  vector<Query> q;
  for (int i = 0; i < n; ++i) q.emplace_back(l[i], r[i], v[i]);
  return sub1(c, q);
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 2 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5056 ms 9692 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 468 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Runtime error 1 ms 468 KB Execution killed with signal 6
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 2 ms 340 KB Output isn't correct
4 Halted 0 ms 0 KB -