結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
dorakazu8134
|
| 提出日時 | 2015-04-20 00:00:07 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 523 bytes |
| コンパイル時間 | 537 ms |
| コンパイル使用メモリ | 65,348 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-04 19:02:03 |
| 合計ジャッジ時間 | 1,229 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 5 WA * 1 RE * 1 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
vector<long long>p;
int n;
cin >> n;
for (int i = 0; i < n; i++){
int x, y;
cin >> x >> y;
if (y - x >= 0){
p.push_back(y - x);
}
}
sort(p.begin(), p.end());
for (int i = 0; i < p.size()-1; i++){
if (p[i] == p[i + 1]){
int c=0;
for (int i2 = i+1; i2 < i + n; i2++){
if (p[i] == p[i2]){
c++;
}
}
if (c == n - 1){
cout << p[i] << endl;
return 0;
}
}
}
cout << "-1" << endl;
}
dorakazu8134