Submission #813914

# Submission time Handle Problem Language Result Execution time Memory
813914 2023-08-08T04:32:23 Z alvingogo Distributing Candies (IOI21_candies) C++17
8 / 100
87 ms 8892 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<long long> pre(n+1);
    int q=l.size();
    for(int i=0;i<q;i++){
        pre[l[i]]+=v[i];
        pre[r[i]+1]-=v[i];
    }
    for(int i=1;i<n;i++){
        pre[i]+=pre[i-1];
    }
    vector<int> s(n);
    for(int i=0;i<n;i++){
        s[i]=(int)min((long long)c[i],pre[i]);
    }
    return s;
}
# 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 87 ms 8804 KB Output is correct
2 Correct 80 ms 8892 KB Output is correct
3 Correct 85 ms 8800 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 0 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 -