結果

問題 No.1265 Balloon Survival
ユーザー onsen_manjuuuonsen_manjuuu
提出日時 2020-11-01 20:24:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 734 bytes
コンパイル時間 1,733 ms
コンパイル使用メモリ 177,616 KB
実行使用メモリ 12,552 KB
最終ジャッジ日時 2023-09-29 11:23:59
合計ジャッジ時間 4,353 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 9 ms
4,380 KB
testcase_15 AC 7 ms
4,380 KB
testcase_16 AC 3 ms
4,376 KB
testcase_17 AC 36 ms
11,460 KB
testcase_18 AC 5 ms
4,376 KB
testcase_19 AC 4 ms
4,380 KB
testcase_20 AC 9 ms
4,376 KB
testcase_21 AC 18 ms
5,272 KB
testcase_22 AC 11 ms
5,028 KB
testcase_23 AC 12 ms
5,092 KB
testcase_24 AC 65 ms
12,552 KB
testcase_25 AC 65 ms
11,652 KB
testcase_26 AC 66 ms
11,892 KB
testcase_27 AC 66 ms
11,780 KB
testcase_28 AC 65 ms
12,552 KB
testcase_29 AC 66 ms
11,980 KB
testcase_30 AC 65 ms
12,348 KB
testcase_31 AC 65 ms
11,824 KB
testcase_32 AC 65 ms
11,956 KB
testcase_33 AC 66 ms
12,036 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:23:14: 警告: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   23 |     for(auto [dist, i, j] : dists) {
      |              ^

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll = long long;


int main()
{
    int N; cin >> N;
    vector<ll> x(N), y(N);
    vector<tuple<ll, int, int>> dists;
    for(int i = 0; i < N; i++)cin >> x[i] >> y[i];

    for(int i = 0; i < N; i++) {
        for(int j = i + 1; j < N; j++) {
            dists.emplace_back((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]), i, j);
        }
    }
    sort(dists.begin(), dists.end());
    vector<bool> remain(N);
    int cnt = 0;

    for(auto [dist, i, j] : dists) {
        if(remain[i] || remain[j])continue;
        if(i && j)remain[i] = remain[j] = true;
        else {
            cnt++;
            remain[j] = true;
        }
    }
    cout << cnt << endl;


}
0