結果
| 問題 |
No.185 和風
|
| コンテスト | |
| ユーザー |
kichirb3
|
| 提出日時 | 2018-02-28 17:07:40 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 793 bytes |
| コンパイル時間 | 790 ms |
| コンパイル使用メモリ | 70,144 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-21 13:51:08 |
| 合計ジャッジ時間 | 1,487 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 6 WA * 1 |
ソースコード
// No.185 和風
// https://yukicoder.me/problems/no/185
//
#include <iostream>
#include <vector>
using namespace std;
int solve(vector<pair<int, int>> &equations);
int main() {
unsigned int N;
cin >> N;
vector<pair<int, int>> equations;
for (auto i = 0; i < N; i++) {
int x, y;
cin >> x >> y;
equations.push_back(make_pair(x, y));
}
int ans = solve(equations);
cout << ans << endl;
}
int solve(vector<pair<int, int>> &equations) {
int ans = equations[0].second - equations[0].first;
if (ans < 0)
return -1;
for (auto i = 1; i < equations.size(); i++) {
int tmp = equations[i].second - equations[i].first;
if (tmp != ans) {
ans = -1;
break;
}
}
return ans;
}
kichirb3