結果

問題 No.602 隠されていたゲーム2
ユーザー merom686merom686
提出日時 2017-12-09 09:50:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 711 bytes
コンパイル時間 765 ms
コンパイル使用メモリ 79,428 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-05-07 10:24:13
合計ジャッジ時間 2,150 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 7 ms
5,376 KB
testcase_18 AC 16 ms
5,376 KB
testcase_19 AC 20 ms
5,376 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;

    vector<int> d(n);
    for (int i = 0; i < n; i++) {
        cin >> d[i];
    }
    sort(d.begin(), d.end());

    int x, y;
    cin >> x >> y;
    int t = x + y; y = x - y; x = t;
    int z = max(abs(x), abs(y));

    int ans = -1;

    for (int i = 0; i < n - 1; i++) {
        if (z <= d[i] + d[i + 1]) ans = 2;
    }
    
    for (int i = 0; i < n; i++) {
        if (z == d[i]) ans = 1;
    }

    if (z == 0) ans = 0;

    cout << ans << endl;

    return 0;
}
0