Submission #838754

# Submission time Handle Problem Language Result Execution time Memory
838754 2023-08-27T17:12:08 Z ErJ Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 10220 KB
#include <vector>
#include <cmath>
#include <algorithm>
#include <iostream>

using namespace std;
typedef long long ll;

vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
    vector<int> ans(c.size());
    for (int i = 0; i < l.size(); i++) {
        for (int j = l[i]; j <= r[i]; j++) {
            if (v[i] > 0) {
                ans[j] = min(c[j], ans[j] + v[i]);
            }
            else {
                ans[j] = max(0, ans[j] + v[i]);
            }
        }
    }
    return ans;
}

Compilation message

candies.cpp: In function 'std::vector<int> distribute_candies(std::vector<int>, std::vector<int>, std::vector<int>, std::vector<int>)':
candies.cpp:11:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 |     for (int i = 0; i < l.size(); i++) {
      |                     ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5036 ms 7244 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 146 ms 7792 KB Output is correct
3 Correct 142 ms 5920 KB Output is correct
4 Execution timed out 5073 ms 10220 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 354 ms 7656 KB Output is correct
4 Correct 342 ms 4012 KB Output is correct
5 Execution timed out 5023 ms 10188 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Execution timed out 5036 ms 7244 KB Time limit exceeded
7 Halted 0 ms 0 KB -