結果

問題 No.3499 I Love DAG
コンテスト
ユーザー gojoxd
提出日時 2026-04-18 18:12:31
言語 C
(gcc 15.2.0)
コンパイル:
gcc-15 -O2 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 511 ms / 2,000 ms
コード長 551 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,029 ms
コンパイル使用メモリ 34,432 KB
実行使用メモリ 30,320 KB
平均クエリ数 18782.41
最終ジャッジ日時 2026-04-18 18:12:47
合計ジャッジ時間 13,588 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <stdio.h>

int main(void) {
    int N, M;
    scanf("%d %d", &N, &M);

    for (int i = 0; i < M; i++) {
        int A, B;
        scanf("%d %d", &A, &B);
        /* Use vertex number as fixed topological order.
           Always direct the edge from the lower-numbered to higher-numbered vertex.
           Since every edge goes "upward" in this ordering, no cycle is possible. */
        if (A < B)
            printf("0\n");  /* A -> B */
        else
            printf("1\n");  /* B -> A */
        fflush(stdout);
    }

    return 0;
}
0