結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2022-08-08 17:36:16 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 647 bytes |
| コンパイル時間 | 746 ms |
| コンパイル使用メモリ | 70,772 KB |
| 最終ジャッジ日時 | 2025-01-30 19:27:02 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
#include <iostream>
#include <list>
#include <vector>
#include <string>
#include <stdio.h>
#include <stdint.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
#define CIN( LL , A ) LL A; cin >> A
#define GETLINE( A ) string A; getline( cin , A )
int main()
{
CIN( ll , N );
ll answer = -1;
ll X;
ll Y;
for( ll i = 0 ; i < N ; i++ ){
cin >> X;
cin >> Y;
const ll d = Y - X;
if( d <= 0 ){
answer = -1;
i = N;
} else if( answer == -1 ){
answer = d;
} else if( answer != d ){
answer = -1;
i = N;
}
}
cout << answer << endl;
return 0;
}