結果
問題 |
No.3280 Black-Tailed Gull vs Monster
|
ユーザー |
![]() |
提出日時 | 2025-09-27 15:28:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 37 ms / 2,000 ms |
コード長 | 793 bytes |
コンパイル時間 | 543 ms |
コンパイル使用メモリ | 45,636 KB |
実行使用メモリ | 7,720 KB |
最終ジャッジ日時 | 2025-09-27 15:28:37 |
合計ジャッジ時間 | 2,971 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 40 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:27:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 27 | scanf("%d%d%d", &n, &x, &qn); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~ main.cpp:32:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 32 | scanf("%d", &m); | ~~~~~^~~~~~~~~~ main.cpp:33:38: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 33 | for (int i = 0; i < m; i++) scanf("%d", fs + i); | ~~~~~^~~~~~~~~~~~~~
ソースコード
/* -*- coding: utf-8 -*- * * 3280.cc: No.3280 Black-Tailed Gull vs Monster - yukicoder */ #include<cstdio> #include<algorithm> using namespace std; /* constant */ const int MAX_M = 200000; /* typedef */ /* global variables */ int fs[MAX_M]; /* subroutines */ /* main */ int main() { int n, x, qn; scanf("%d%d%d", &n, &x, &qn); int sum = 0; while (qn--) { int m; scanf("%d", &m); for (int i = 0; i < m; i++) scanf("%d", fs + i); sort(fs, fs + m); bool ua = false, fa = false; for (int i = 0; i < m;) { int j = i; while (i < m && fs[j] == fs[i]) i++; if (fs[j] == x) { ua = true; break; } if (i - j > 1) fa = true; } if (ua) sum += 2; else if (fa) sum++; } printf("%.1lf\n", 0.5 * sum); return 0; }