# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1058597 | qwusha | Distributing Candies (IOI21_candies) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define fi first
#define se second
typedef long double ld;
const ld eps = 1e-8;
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
const ll inf = 1e18;
const ll mod = 1e9 + 7;
#include "candies.h"
int[] distribute_candies(int[] c, int[] l, int[] r, int[] v) {
int n = c.size();
vector<int> res(n);
for (int qw = 0; qw < l.size(); qw++) {
for (int i = l[qw]; i <= r[qw]; i++) {
if (v[qw] > 0) {
res[i] = min(res[i] + v[qw], c[i]);
} else {
res[i] = max(res[i] - v[qw], 0);
}
}
}
return res;
}