Submission #438756

# Submission time Handle Problem Language Result Execution time Memory
438756 2021-06-28T14:50:33 Z MohamedFaresNebili Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13264 KB
#include <bits/stdc++.h>
#include "candies.h"

using namespace std;
 
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 = v.size();
    std::vector<int> s(n);
    for(int i=0;i<n;i++) s[i]=0;
    for(int i=0;i<q;i++) {
        int lo=l[i], hi=r[i];
        for(int k=lo;k<=hi;k++) {
            if(v[i]>0) { s[k]=min(v[i]+s[k], c[k]); }
            else { s[k]=max(v[i]+s[k], 0); }
        }
    }
    return s;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5069 ms 7216 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 213 ms 8020 KB Output is correct
3 Correct 204 ms 6012 KB Output is correct
4 Execution timed out 5029 ms 13264 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 525 ms 4960 KB Output is correct
4 Correct 494 ms 4020 KB Output is correct
5 Execution timed out 5078 ms 10784 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 248 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
6 Execution timed out 5069 ms 7216 KB Time limit exceeded
7 Halted 0 ms 0 KB -