# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
435739 | illyakr | Distributing Candies (IOI21_candies) | C++17 | 129 ms | 8100 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "candies.h"
using namespace std;
vector<int> res;
int n, q;
bool scbl = true;
std::vector<int> distribute_candies(std::vector<int> c, std::vector<int> l,
std::vector<int> r, std::vector<int> v) {
n = c.size(); q = v.size();
res.resize(n, 0);
for (int i = 0; i < q; i++)
if (v[i] < 0){scbl = false;break;}
if (n * q <= 100000000) {
for (int i = 0; i < q; i++) {
for (int j = l[i]; j <= r[i]; j++) {
res[j] += v[i];
if (res[j] < 0)res[j] = 0;
else if (res[j] > c[j])res[j] = c[j];
}
}
return res;
}
if (scbl) {
for (int i = 0; i < q; i++) {
res[l[i]] += v[i];
res[r[i] + 1] -= v[i];
}
for (int i = 1; i < n; i++)
res[i] += res[i - 1];
for (int i = 0; i < n; i++)
res[i] = min(res[i], c[i]);
return res;
}
}
/**
3
10 15 13
2
0 2 20
0 1 -11
0 4 13
*/
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |