結果

問題 No.185 和風
コンテスト
ユーザー _k_a_n_i_
提出日時 2015-04-23 18:03:57
言語 Java
(openjdk 26.0.2.1 + ACL)
コンパイル:
javac -J-Duser.language=en -encoding UTF8 -cp /opt/aclib/ac_library.jar _filename_
実行:
java -ea -Xmx700m -Xss256M -DONLINE_JUDGE=true -cp .:/opt/aclib/ac_library.jar _class_
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 858 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,331 ms
コンパイル使用メモリ 86,092 KB
実行使用メモリ 49,640 KB
最終ジャッジ日時 2026-10-11 07:35:19
合計ジャッジ時間 3,147 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import java.util.Scanner;

public class Main
{
    private final static Main main = new Main();

    public static void main(String[] args)
    {
        long l = System.currentTimeMillis();
        main.solve();
        //System.out.println("処理時間:" + (System.currentTimeMillis() - l));
    }

    private void solve()
    {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int ans = (sc.nextInt()-sc.nextInt())*-1;
        boolean flag = false;
        for(int i=1; i<n; ++i)
        {
            int x = sc.nextInt();
            int y = sc.nextInt();
            if(ans + x == y)
            {
                flag = true;
            }
            else
            {
                flag = false;
                break;
            }
        }
        System.out.println(flag && ans > 0 ? ans : -1);
    }
}
0