이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
///
/// Let the voice of love take you higher!
///
#define _USE_MATH_DEFINES
#define FAST ios::sync_with_stdio(false),cin.tie(0);
#include <bits/stdc++.h>
#define Loop(x, l, r) for(int x = (l); x < (r); ++x)
#define LoopR(x, l, r) for(int x = (r)-1; x >= (l); --x)
#define all(x) x.begin(), x.end()
#define Kill(x) exit((cout << (x) << '\n', 0))
#define YN(flag) ((flag)? "YES": "NO")
#define F first
#define S second
typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int,int> pii;
typedef std::pair<ll ,ll > pll;
using namespace std;
#pragma GCC optimize("O3", "unroll-loops")
#pragma GCC target("avx")
typedef vector<int> vec;
const int N = 200'010;
int a[N], c[N], l[N], r[N], v[N];
int n, q;
vec distribute_candies(vec cc, vec ll, vec rr, vec vv)
{
n = cc.size();
q = ll.size();
Loop(i,0,n) c[i] = cc[i];
Loop(i,0,q) l[i] = ll[i], r[i] = rr[i], v[i] = vv[i];
Loop(i,0,q)
{
int v = ::v[i], l = ::l[i], r = ::r[i]+1;
if(i&1)
{
if(v <= 0)
Loop(j,l,r)
a[j] = a[j]+v<0?0:a[j]+v;
else
Loop(j,l,r)
a[j] = a[j]+v>c[j]?c[j]:a[j]+v;
}
else
{
if(v <= 0)
LoopR(j,l,r)
a[j] = a[j]+v<0?0:a[j]+v;
else
LoopR(j,l,r)
a[j] = a[j]+v>c[j]?c[j]:a[j]+v;
}
}
vec ans(n);
Loop(i,0,n) ans[i] = a[i];
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |