結果
問題 |
No.3166 [Cherry 7th Tune *] 桜の守人
|
ユーザー |
![]() |
提出日時 | 2025-05-30 23:08:49 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 562 bytes |
コンパイル時間 | 2,481 ms |
コンパイル使用メモリ | 113,356 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2025-05-30 23:08:53 |
合計ジャッジ時間 | 3,043 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 26 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:16:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 16 | scanf("%d", &t); | ~~~~~^~~~~~~~~~ main.cpp:20:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 20 | scanf("%d%d%d", &n, &l, &k); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~ main.cpp:21:38: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 21 | for (int i = 0; i < n; ++i) scanf("%d", &a[i]); | ~~~~~^~~~~~~~~~~~~
ソースコード
# pragma GCC target("avx2") # pragma GCC optimize("O3") # pragma GCC optimize("unroll-loops") #include <iostream> #include <vector> #include <algorithm> using namespace std; int a[40000]; int main() { int t; scanf("%d", &t); while (t--) { int n, l, k; scanf("%d%d%d", &n, &l, &k); for (int i = 0; i < n; ++i) scanf("%d", &a[i]); for (int i = 0; i < n; ++i) a[i + n] = a[i] + l; sort(a, a + 2 * n); int ma = 0; for (int i = 0; i < n; ++i) ma = max(a[i + k] - a[i], ma); ++ma; ma >>= 1; printf("%d\n", ma); } }