結果

問題 No.3155 Same Birthday
ユーザー hex4448
提出日時 2025-06-01 22:21:58
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 36 ms / 2,000 ms
コード長 394 bytes
コンパイル時間 362 ms
コンパイル使用メモリ 24,576 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-06-01 22:22:03
合計ジャッジ時間 4,627 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 49
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:6:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    6 |     scanf("%d", &N);
      |     ^~~~~~~~~~~~~~~
main.c:11:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%d %d", &month, &day);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <stdbool.h>

int main(void) {
    int N;
    scanf("%d", &N);
    static bool seen[1001][1001] = { false };

    for (int i = 0; i < N; i++) {
        int month, day;
        scanf("%d %d", &month, &day);

        if (seen[month][day]) {
            puts("Yes");
            return 0;
        }
        seen[month][day] = true;
    }

    puts("No");
    return 0;
}
0