Submission #975069

# Submission time Handle Problem Language Result Execution time Memory
975069 2024-05-04T11:24:51 Z pransh_8 Distributing Candies (IOI21_candies) C++17
0 / 100
5000 ms 12268 KB
//pransh_8
#include "candies.h"
#include <bits/stdc++.h>

using namespace std;

//Macros:
#define     FOR(i, a, n)                    for(int i=a;i<n;++i)
#define     FORR(i, a, n)                   for(int i=a;i>=n;--i)

/*------------------------------Code-Begins----------------------------------*/

vector<int> distribute_candies(vector<int> c, vector<int> l, vector<int> r, vector<int> v) {
    int n = c.size(), q = l.size();
    vector<int> ans(n);
    FOR(i,0,q) {
        FOR(k,l[i]-1,r[i]) {
            if (v[i]>0)
                ans[k]=min((long long)c[k],(long long)(ans[k]+v[i]));
            else
                ans[k]=max(0ll,(long long)(ans[k]+v[i]));
        }
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5008 ms 12268 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -