結果
問題 | No.185 和風 |
ユーザー |
![]() |
提出日時 | 2015-04-19 23:22:14 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,228 bytes |
コンパイル時間 | 1,420 ms |
コンパイル使用メモリ | 159,056 KB |
実行使用メモリ | 6,940 KB |
最終ジャッジ日時 | 2024-07-04 18:15:36 |
合計ジャッジ時間 | 1,987 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 1 ms
5,376 KB |
testcase_03 | AC | 1 ms
5,376 KB |
testcase_04 | AC | 2 ms
5,376 KB |
testcase_05 | WA | - |
testcase_06 | AC | 1 ms
5,376 KB |
ソースコード
// Template {{{ #include <bits/stdc++.h> #define REP(i,n) for(int i=0; i<(int)(n); ++i) using namespace std; typedef long long LL; #ifdef LOCAL #include "contest.h" #else #define dump(x) #endif class range { struct Iterator { int val, inc; int operator*() {return val;} bool operator!=(Iterator& rhs) {return val < rhs.val;} void operator++() {val += inc;} }; Iterator i, n; public: range(int e) : i({0, 1}), n({e, 1}) {} range(int b, int e) : i({b, 1}), n({e, 1}) {} range(int b, int e, int inc) : i({b, inc}), n({e, inc}) {} Iterator& begin() {return i;} Iterator& end() {return n;} }; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; inline bool valid(int x, int w) { return 0 <= x && x < w; } void iostream_init() { ios::sync_with_stdio(false); cin.tie(0); cout.setf(ios::fixed); cout.precision(12); } //}}} int main(){ iostream_init(); int N; cin >> N; int x, y; cin >> x >> y; int ans = y-x; REP(i, N-1) { int x, y; cin >> x >> y; if(ans != y-x) ans = -1; } if(ans < 0) ans = -1; cout << ans << endl; return 0; } /* vim:set foldmethod=marker: */