Submission #530464

# Submission time Handle Problem Language Result Execution time Memory
530464 2022-02-25T12:28:34 Z Icebear16 Distributing Candies (IOI21_candies) C++17
0 / 100
89 ms 8016 KB
#include "candies.h"
#include <vector>
#include <algorithm>

std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l, std::vector<int> r, std::vector<int> v) {
    int n=c.size();
    int q=l.size();
    std::vector<int> s(n,0);
    s.push_back(0);
    int h=0,k=0;
    for(int j=0;j<q;j++){
    h=l[j];
    s[h]+=v[j];
    k=r[j]+1;
    s[k]-=v[j];
    }
    for(int i=1;i<=n;i++){
    	s[i]+=s[i-1];
    }
    s.pop_back();
    for(int i=0;i<n;i++){
      if(s[i]>c[i]){
      	s[i]=c[i];
      }
    }
    return s;
}
# 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 89 ms 8016 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 -
# 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 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -