제출 #1197092

#제출 시각아이디문제언어결과실행 시간메모리
1197092sleepntsheepRainy Markets (CCO22_day1problem2)C11
5 / 25
396 ms46580 KiB
#include <stdio.h> #define N 1000000 int n, a[N][3], b[N], p[N], u[N]; long long x, z; int main() { scanf("%d", &n); for (int i = 0; i < n; ++i) scanf("%d", &b[i]); for (int i = 0; i + 1 < n; ++i) scanf("%d", &p[i]); for (int i = 0; i + 1 < n; ++i) scanf("%d", &u[i]); x = 0; for (int i = 0; i + 1 < n; ++i) { if (b[i] >= p[i]) { a[i][0] = p[i]; b[i] -= p[i]; p[i] = 0; x = 0; } else { a[i][0] = b[i]; p[i] -= b[i]; b[i] = 0; x += u[i]; if (b[i + 1] >= p[i]) { a[i][2] = p[i]; b[i + 1] -= p[i]; p[i] = 0; } else { a[i][2] = b[i + 1]; p[i] -= b[i + 1]; b[i + 1] = 0; if (p[i] > x) { puts("NO"); return 0; } a[i][1] = p[i]; z += p[i]; x -= p[i]; } } } puts("YES"); printf("%lld\n", z); for (int i = 0; i + 1 < n; ++i) { for (int j = 0; j < 3; ++j) { printf("%d ", a[i][j]); } puts(""); } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Main.c: In function 'main':
Main.c:9:5: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d", &n);
      |     ^~~~~~~~~~~~~~~
Main.c:10:33: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     for (int i = 0; i < n; ++i) scanf("%d", &b[i]);
      |                                 ^~~~~~~~~~~~~~~~~~
Main.c:11:37: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     for (int i = 0; i + 1 < n; ++i) scanf("%d", &p[i]);
      |                                     ^~~~~~~~~~~~~~~~~~
Main.c:12:37: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     for (int i = 0; i + 1 < n; ++i) scanf("%d", &u[i]);
      |                                     ^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...