Submission #1058609

# Submission time Handle Problem Language Result Execution time Memory
1058609 2024-08-14T11:28:50 Z qwusha Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 10992 KB
#include "candies.h"

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
typedef long double ld;
const ld eps = 1e-8;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
const ll inf = 1e18;
const ll mod = 1e9 + 7;


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

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:19:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for (int qw = 0; qw < l.size(); qw++) {
      |                      ~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5059 ms 7252 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 105 ms 6860 KB Output is correct
3 Correct 99 ms 5388 KB Output is correct
4 Execution timed out 5064 ms 10656 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 272 ms 6900 KB Output is correct
4 Correct 279 ms 4036 KB Output is correct
5 Execution timed out 5077 ms 10992 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Execution timed out 5059 ms 7252 KB Time limit exceeded
7 Halted 0 ms 0 KB -