結果

問題 No.185 和風
ユーザー fumi6328fumi6328
提出日時 2018-08-23 16:50:53
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 414 bytes
コンパイル時間 1,378 ms
コンパイル使用メモリ 50,888 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-27 06:27:56
合計ジャッジ時間 904 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main()
{
    int n;
    cin >> n;

    int x[1000],y[1000];
    int ans,flag = 0;
    for(int i = 0; i < n; i++){
        cin >> x[i] >> y[i];
        if(i > 0 && (y[i]-x[i] != y[i-1]-x[i-1]))
            flag = 1;
    }

    if(flag == 0 && y[0]-x[0] >= 0)
        cout << y[0]-x[0] << endl;
    else
        cout << -1 << endl;

    return 0;
}
0