結果
問題 |
No.3281 Pacific White-sided Dolphin vs Monster
|
ユーザー |
![]() |
提出日時 | 2025-09-27 13:40:01 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 662 bytes |
コンパイル時間 | 364 ms |
コンパイル使用メモリ | 27,184 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-09-27 13:40:13 |
合計ジャッジ時間 | 2,965 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 48 WA * 2 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf("%lld", &n); | ^~~~~~~~~~~~~~~~~ main.c:9:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%lld", &H[i]); | ^~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> long long int H[100005]; int main() { long long int n; scanf("%lld", &n); long long int i; for (i = 0; i < n; i++) scanf("%lld", &H[i]); long long int ans = 0; long long int cnt = 0, nn; nn = 0; for (i = 0; i < n; i++) { if (H[i] > 1) { H[nn] = H[i]; nn++; } else cnt++; } n = nn; while (n + cnt > 0) { ans++; if (cnt > 0) cnt--; else { for (i = 0; i < n && H[i] % 2 == 0; i++); i %= n; H[i]--; } nn = 0; for (i = 0; i < n; i++) { H[i] = (H[i] + 1) / 2; if (H[i] > 1) { H[nn] = H[i]; nn++; } else cnt++; } n = nn; } printf("%lld\n", ans); return 0; }