Submission #440379

# Submission time Handle Problem Language Result Execution time Memory
440379 2021-07-02T08:14:57 Z i_am_noob Distributing Candies (IOI21_candies) C++17
0 / 100
132 ms 7256 KB
#include "candies.h"
#include<bits/stdc++.h>
using namespace std;

#define ll long long
//#define int ll
#define rep(n) rep1(i,n)
#define rep1(i,n) rep2(i,0,n)
#define rep2(i,a,b) for(int i=a; i<(b); ++i)
#define rep3(i,a,b) for(int i=a; i>=(b); --i)
#define chkmax(a,b) (a=max(a,b))
#define chkmin(a,b) (a=min(a,b))
#define sz(a) ((int)a.size())
#define all(a) a.begin(),a.end()
#define pb push_back
#define pii pair<int,int>
#define pow2(x) (1ll<<(x))
#ifdef zisk
#define bug(...) cerr << "#" << __LINE__ << ": " << #__VA_ARGS__ << "- ", _do(__VA_ARGS__)
template<typename T> void _do(T x){cerr << x << endl;}
template<typename T, typename ...S> void _do(T x, S... y){cerr << x << ", "; _do(y...);}
#else
#define bug(...) 49
#endif

int n,q;

vector<int> distribute_candies(vector<int> c, vector<int> l,
                                    vector<int> r, vector<int> v) {
    n=sz(c);
    q=sz(l);
    vector<int> res(n);
    rep1(j,q){
    	if(r[j]<n-1) res[r[j]+1]-=v[j];
    	res[l[j]]+=v[j];
    }
    rep2(i,1,n) res[i]+=res[i-1];
    rep(n) chkmin(res[i],c[i]),chkmax(res[i],0);
    return res;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 132 ms 7256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -