結果

問題 No.185 和風
ユーザー トミー
提出日時 2024-03-31 17:17:25
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 463 bytes
コンパイル時間 1,794 ms
コンパイル使用メモリ 194,188 KB
最終ジャッジ日時 2025-02-20 18:08:23
ジャッジサーバーID
(参考情報)
judge3 / judge5
外部呼び出し有り
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:24:11: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   24 |     system("pause");
      |     ~~~~~~^~~~~~~~~

ソースコード

diff #

// コピーして使う!
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vll = vector<long long>;

int main() {
    ll n;
    cin >> n;
    vll x(n), y(n);
    for (ll i = 0; i != n; i++) {
        cin >> x[i] >> y[i];
    }
    ll a;
    a = y[0] - x[0];
    for (ll i = 1; i != n; i++) {
        if (a != y[i] - x[i] || a <= 0) {
            a = -1;
            break;
        }
    }
    cout << a << endl;

    system("pause");
}
0