Submission #436426

# Submission time Handle Problem Language Result Execution time Memory
436426 2021-06-24T13:32:32 Z PiejanVDC Distributing Candies (IOI21_candies) C++17
0 / 100
128 ms 8040 KB
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
    vector<int>sum(c.size()+1,0);
    for(int i = 0 ; i < v.size() ; i++) {
        sum[l[i]]+=v[i],sum[r[i]+1]-=v[i];
    }
    vector<int>ans(c.size());
    int current_sum=0;
    for(int i = 0 ; i < c.size() ; i++) {
            current_sum+=sum[i];
            ans[i] = min(c[i],current_sum);
    }
    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:7:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |     for(int i = 0 ; i < v.size() ; i++) {
      |                     ~~^~~~~~~~~~
candies.cpp:12:23: 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 < c.size() ; i++) {
      |                     ~~^~~~~~~~~~
# 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 128 ms 8040 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 1 ms 204 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 -