Submission #451552

# Submission time Handle Problem Language Result Execution time Memory
451552 2021-08-03T08:45:56 Z T0p_ Distributing Candies (IOI21_candies) C++17
3 / 100
492 ms 6460 KB
#include "candies.h"
#include <bits/stdc++.h>
using namespace std;

const int N = 2e5+5;

int n, q;
int arr[N], capacity[N];

vector<int> distribute_candies(vector<int> c, vector<int> l,
                                    vector<int> r, vector<int> v) {
    n = c.size(), q = l.size();
    if(n > 2000) return {};
    for(int i=1 ; i<=n ; i++) capacity[i] = c[i-1];
    for(int i=0 ; i<q ; i++)
    {
        int a = l[i]+1, b = r[i]+1, c = v[i];
        for(int j=a ; j<=b ; j++)
        {
            arr[j] += c;
            arr[j] = max(arr[j], 0);
            arr[j] = min(arr[j], capacity[j]);
        }
    }
    vector<int> ret;
    for(int i=1 ; i<=n ; i++) ret.push_back(arr[i]);
    return ret;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 96 ms 6460 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 233 ms 5040 KB Output is correct
3 Incorrect 29 ms 1848 KB Output isn't correct
4 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 492 ms 5048 KB Output is correct
4 Incorrect 27 ms 1860 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 3 ms 332 KB Output is correct
6 Incorrect 96 ms 6460 KB Output isn't correct
7 Halted 0 ms 0 KB -