Submission #481459

# Submission time Handle Problem Language Result Execution time Memory
481459 2021-10-21T01:42:54 Z yungyao Distributing Candies (IOI21_candies) C++17
8 / 100
101 ms 12552 KB
using namespace std;
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>

typedef long long LL;
typedef pair<int,int> pii;
#define pb push_back
#define mkp make_pair
#define F first
#define S second
#define REP(n) for (int __=n;__--;)
#define REP1(i,n) for (int i=1;i<=n;++i)
#define REP0(i,n) for (int i=0;i<n;++i)
typedef vector <int> vi;

#include "candies.h"

vi distribute_candies(vi c,vi l,vi r,vi v){
    int n = c.size(),q = v.size();

    vi ret(n);
    vector <LL> pre(n+1);
    REP0(i,q){
        pre[l[i]] += v[i];
        pre[r[i]+1] -= v[i];
    }

    REP0(i,n){
        if (i) pre[i] += pre[i-1];
        ret[i] = min((LL)c[i],pre[i]);
    }
    return ret;
}

# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 101 ms 8804 KB Output is correct
2 Correct 95 ms 12552 KB Output is correct
3 Correct 90 ms 12548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -