結果

問題 No.185 和風
ユーザー aoharu9825aoharu9825
提出日時 2019-07-18 12:48:06
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 765 bytes
コンパイル時間 658 ms
コンパイル使用メモリ 28,392 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 16:42:54
合計ジャッジ時間 1,226 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include<stdio.h>
#include<stdlib.h>

typedef long long int ll;

int MIN(int a, int b){return a>b?b:a;}
int MAX(int a, int b){return a>b?a:b;}
int compare(const void* a, const void* b){
    return *(int*)a - *(int*)b;
}

int main(void){
    int n;
    scanf("%d", &n);
    int pair[n][2];
    for(int i=0; i<n; i++){
        scanf("%d %d", &pair[i][0], &pair[i][1]);
    }

    int res = 1;
    int diff = pair[0][1] - pair[0][0];
    if(diff < 0){
        res = 0;
    }else{
        for(int i=1; i<n; i++){
            int tmp = pair[i][1]-pair[i][0];
            if(tmp != diff){
                res = 0;
                break;
            }
        }
    }

    if(res==1){
        printf("%d\n", diff);
    }else{
        printf("-1\n");
    }

    return 0;
}
0