結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
SSRS
|
| 提出日時 | 2020-07-18 20:58:35 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 410 bytes |
| コンパイル時間 | 1,655 ms |
| コンパイル使用メモリ | 168,044 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-14 07:01:13 |
| 合計ジャッジ時間 | 2,327 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> X(N), Y(N);
for (int i = 0; i < N; i++){
cin >> X[i] >> Y[i];
}
int ans = Y[0] - X[0];
bool ok = true;
for (int i = 1; i < N; i++){
if (ans != Y[i] - X[i]){
ok = false;
}
}
if (ans <= 0){
ok = false;
}
if (!ok){
cout << -1 << endl;
} else {
cout << ans << endl;
}
}
SSRS