Submission #500208

# Submission time Handle Problem Language Result Execution time Memory
500208 2021-12-30T13:11:06 Z sazid_alam Distributing Candies (IOI21_candies) C++17
0 / 100
100 ms 12124 KB
#include "candies.h"

#include <bits/stdc++.h>
using namespace std;
//using int long long;

vector<int> distribute_candies(vector<int> c, vector<int> l,
                                    vector<int> r, vector<int> v) {
    int n = c.size();
    vector<int> sum(n + 1, 0);

    for(int i = 0; i < v.size(); i++){
        sum[l[i]] += v[i];
        sum[r[i] + 1] -= v[i];
    }

    for(int i = 1; i < n; i++) sum[i] += sum[i - 1];
    for(int i = 0; i < n; i++) c[i] = min(c[i], sum[i]);

    return c;
}

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:12:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |     for(int i = 0; i < v.size(); i++){
      |                    ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 100 ms 12124 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 284 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -