結果
問題 |
No.865 24時間降水量
|
ユーザー |
![]() |
提出日時 | 2019-08-16 21:59:20 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 662 bytes |
コンパイル時間 | 119 ms |
コンパイル使用メモリ | 23,808 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-22 16:25:21 |
合計ジャッジ時間 | 1,495 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 3 WA * 12 RE * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d", &n); | ~~~~~^~~~~~~~~~ main.cpp:7:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%d", a + i); | ~~~~~^~~~~~~~~~~~~ main.cpp:10:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 10 | scanf("%d", &q); | ~~~~~^~~~~~~~~~ main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d%d", &t, &v); | ~~~~~^~~~~~~~~~~~~~~~
ソースコード
#include <cstdio> int main(void) { int n, q, a[2001] = {}, sum[2002] = {}; scanf("%d", &n); for(int i = 0; i < n; i++) { scanf("%d", a + i); sum[i + 1] = sum[i] + a[i]; } scanf("%d", &q); for(int i = 0; i < q; i++) { int t, v; scanf("%d%d", &t, &v); int tmp = v - a[t - 1]; for(int j = 0; j < 24; j++) { sum[t + j] += tmp; } a[t - 1] = v; int max = 0; for(int j = 24; j <= n; j++) { if(max < sum[j] - sum[j - 24]) { max = sum[j] - sum[j - 24]; } } printf("%d\n", max); } return 0; }