# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
823870 | rainboy | Triangle Collection (CCO23_day2problem3) | C11 | 57 ms | 1372 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <string.h>
#define N 2000
int main() {
static int aa[N], aa_[N];
int n, q, i, j, d, k, ans;
scanf("%d%d", &n, &q);
for (i = 0; i < n; i++)
scanf("%d", &aa[i]);
while (q--) {
scanf("%d%d", &i, &d), i--;
aa[i] += d;
memcpy(aa_, aa, n * sizeof *aa);
ans = 0;
for (i = n - 1, j = n - 1; i >= 0; i--)
while (aa_[i] >= 2) {
while (j >= 0 && (j > i * 2 || aa_[j] % 2 == 0))
j--;
if (j >= 0)
ans++, aa_[i] -= 2, aa_[j]--;
else {
k = 0;
while (i >= 0)
k += aa_[i], i--;
ans += k / 3;
break;
}
컴파일 시 표준 에러 (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... |