Submission #596106

# Submission time Handle Problem Language Result Execution time Memory
596106 2022-07-14T11:38:13 Z SuhaibSawalha1 Distributing Candies (IOI21_candies) C++17
8 / 100
97 ms 12884 KB
#include "candies.h"
#include <bits/stdc++.h>
#include <vector>
using namespace std;

vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
  int n = c.size(), q = l.size();
  vector<int> a(n);
  vector<long long> b(n + 1);
  for (int qs = 0; qs < q; ++qs) {
    b[r[qs] + 1] -= v[qs];
    b[l[qs]] += v[qs];
  }
  long long s = 0;
  for (int i = 0; i < n; ++i) {
    s += b[i];
    a[i] = min(c[i] * 1LL, s);
  }
  return a;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 94 ms 8892 KB Output is correct
2 Correct 97 ms 12884 KB Output is correct
3 Correct 89 ms 12748 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -