結果
問題 |
No.2922 Rose Garden
|
ユーザー |
![]() |
提出日時 | 2024-10-13 16:27:42 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 27 ms / 3,000 ms |
コード長 | 599 bytes |
コンパイル時間 | 610 ms |
コンパイル使用メモリ | 39,936 KB |
最終ジャッジ日時 | 2025-02-24 19:16:51 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 50 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:29:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 29 | scanf("%d%d%d", &n, &s, &b); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~ main.cpp:30:36: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 30 | for (int i = 0; i < n; i++) scanf("%d", hs + i); | ~~~~~^~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*- * * 2922.cc: No.2922 Rose Garden - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ const int MAX_N = 200000; /* typedef */ using ll = long long; /* global variables */ int hs[MAX_N]; /* subroutines */ /* main */ int main() { int n, s, b; scanf("%d%d%d", &n, &s, &b); for (int i = 0; i < n; i++) scanf("%d", hs + i); ll sb = (ll)s * b; int ph = hs[0]; for (int i = 1; i < n; i++) if (hs[i] > ph) { if (hs[i] > ph + sb) { puts("No"); return 0; } ph = hs[i]; } puts("Yes"); return 0; }