Submission #440377

# Submission time Handle Problem Language Result Execution time Memory
440377 2021-07-02T08:11:29 Z i_am_noob Distributing Candies (IOI21_candies) C++17
3 / 100
5000 ms 7268 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){
    	rep2(i,l[j],r[j]+1){
			res[i]+=v[j];
			chkmin(res[i],c[i]);
			chkmax(res[i],0);
    	}
    }
    return res;
}
# 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 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 Execution timed out 5103 ms 7268 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 271 ms 5020 KB Output is correct
3 Correct 238 ms 3700 KB Output is correct
4 Execution timed out 5048 ms 7260 KB Time limit exceeded
5 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 626 ms 5016 KB Output is correct
4 Correct 634 ms 2696 KB Output is correct
5 Execution timed out 5062 ms 7268 KB Time limit exceeded
6 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 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 Execution timed out 5103 ms 7268 KB Time limit exceeded
7 Halted 0 ms 0 KB -