Submission #788516

# Submission time Handle Problem Language Result Execution time Memory
788516 2023-07-20T10:09:37 Z alexander707070 Distributing Candies (IOI21_candies) C++17
8 / 100
81 ms 13660 KB
#include<bits/stdc++.h>
#define MAXN 1000007
using namespace std;
 
int n,q;
long long s,sum[MAXN];
vector<int> curr;

vector<int> distribute_candies(vector<int> c,vector<int> l,vector<int> r,vector<int> v){
    n=int(c.size()); q=int(l.size());
    curr.resize(n);

    for(int i=0;i<q;i++){
        sum[l[i]]+=v[i];
        sum[r[i]+1]-=v[i];
    }

    for(int i=0;i<n;i++){
        s+=sum[i];
        if(s>c[i])curr[i]=c[i];
        else curr[i]=s;
    }

    return curr;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 81 ms 9712 KB Output is correct
2 Correct 79 ms 13660 KB Output is correct
3 Correct 76 ms 13532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -