Submission #813906

# Submission time Handle Problem Language Result Execution time Memory
813906 2023-08-08T04:30:29 Z alvingogo Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 7284 KB
#include "candies.h"
#include <bits/stdc++.h>
#define fs first
#define sc second
#define p_q priority_queue
using namespace std;

vector<int> distribute_candies(vector<int> c, vector<int> l,
                                    vector<int> r, vector<int> v) {
    int n = c.size();
    vector<int> s(n);
    int q=l.size();
    for(int i=0;i<q;i++){
        if(v[i]<0){
            for(int j=l[i];j<=r[i];j++){
                s[j]=max(0,s[j]+v[i]);
            }
        }
        else{
            for(int j=l[i];j<=r[i];j++){
                s[j]=min(c[j],s[j]+v[i]);
            }
        }
    }
    return s;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5034 ms 7264 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 144 ms 5024 KB Output is correct
3 Correct 138 ms 3828 KB Output is correct
4 Execution timed out 5032 ms 7268 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 382 ms 5024 KB Output is correct
4 Correct 383 ms 2804 KB Output is correct
5 Execution timed out 5034 ms 7284 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Execution timed out 5034 ms 7264 KB Time limit exceeded
7 Halted 0 ms 0 KB -