Submission #968588

# Submission time Handle Problem Language Result Execution time Memory
968588 2024-04-23T16:22:46 Z IUA_Hasin Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 13520 KB
#include "candies.h"

#include <bits/stdc++.h>
 
#define endl                                "\n"
#define yeap                                cout<<"YES"<<endl
#define nope                                cout<<"NO"<<endl
#define ll                                  long long
 
using namespace std; 

std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
                                    std::vector<int> r, std::vector<int> v) {
    ll n = c.size();
    std::vector<int> s(n, 0);

    ll q = l.size();
    for(int i=0; i<q; i++){
        ll a = l[i];
        ll b = r[i];
        ll d = v[i];
        for(int j=a; j<=b; j++){
            int x = s[j]+d;
            if(d>=0){
                s[j] = min(c[j], x);
            } else {
                s[j] = max(0, x);
            }
        }
    }
    return s;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5030 ms 12128 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 153 ms 8172 KB Output is correct
3 Correct 141 ms 6028 KB Output is correct
4 Execution timed out 5095 ms 13520 KB Time limit exceeded
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 396 ms 7792 KB Output is correct
4 Correct 363 ms 4128 KB Output is correct
5 Execution timed out 5100 ms 10976 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 2 ms 348 KB Output is correct
6 Execution timed out 5030 ms 12128 KB Time limit exceeded
7 Halted 0 ms 0 KB -