結果
問題 |
No.185 和風
|
ユーザー |
![]() |
提出日時 | 2019-02-09 08:25:44 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 441 bytes |
コンパイル時間 | 1,840 ms |
コンパイル使用メモリ | 165,660 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-01 11:52:55 |
合計ジャッジ時間 | 1,758 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { // 1. 入力情報取得. int N; cin >> N; map<int, int> m; for(int i = 0; i < N; i++){ int x, y; cin >> x >> y; m[(y - x)]++; } // 2. 新規性は? int ans = -1; for(auto &p : m) ans = p.first; if(m.size() > 1 || ans <= 0) ans = -1; // 3. 後処理. cout << ans << endl; return 0; }