結果
問題 | No.202 1円玉投げ |
ユーザー | kurenai3110 |
提出日時 | 2017-03-14 22:37:34 |
言語 | C++11 (gcc 11.4.0) |
結果 |
AC
|
実行時間 | 617 ms / 5,000 ms |
コード長 | 1,329 bytes |
コンパイル時間 | 710 ms |
コンパイル使用メモリ | 76,592 KB |
実行使用メモリ | 5,464 KB |
最終ジャッジ日時 | 2023-08-23 23:31:36 |
合計ジャッジ時間 | 5,921 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 227 ms
5,360 KB |
testcase_01 | AC | 101 ms
5,324 KB |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 6 ms
4,376 KB |
testcase_06 | AC | 80 ms
5,240 KB |
testcase_07 | AC | 92 ms
5,060 KB |
testcase_08 | AC | 93 ms
5,424 KB |
testcase_09 | AC | 44 ms
4,380 KB |
testcase_10 | AC | 17 ms
4,380 KB |
testcase_11 | AC | 36 ms
4,376 KB |
testcase_12 | AC | 37 ms
4,376 KB |
testcase_13 | AC | 19 ms
4,376 KB |
testcase_14 | AC | 6 ms
4,376 KB |
testcase_15 | AC | 43 ms
4,384 KB |
testcase_16 | AC | 81 ms
5,420 KB |
testcase_17 | AC | 391 ms
5,464 KB |
testcase_18 | AC | 392 ms
5,376 KB |
testcase_19 | AC | 40 ms
4,376 KB |
testcase_20 | AC | 70 ms
5,244 KB |
testcase_21 | AC | 40 ms
4,380 KB |
testcase_22 | AC | 2 ms
4,376 KB |
testcase_23 | AC | 2 ms
4,380 KB |
testcase_24 | AC | 2 ms
4,376 KB |
testcase_25 | AC | 2 ms
4,380 KB |
testcase_26 | AC | 4 ms
4,376 KB |
testcase_27 | AC | 4 ms
4,376 KB |
testcase_28 | AC | 2 ms
4,376 KB |
testcase_29 | AC | 2 ms
4,376 KB |
testcase_30 | AC | 2 ms
4,376 KB |
testcase_31 | AC | 2 ms
4,380 KB |
testcase_32 | AC | 3 ms
4,380 KB |
testcase_33 | AC | 3 ms
4,376 KB |
testcase_34 | AC | 2 ms
4,380 KB |
testcase_35 | AC | 613 ms
5,280 KB |
testcase_36 | AC | 122 ms
5,360 KB |
testcase_37 | AC | 101 ms
5,380 KB |
testcase_38 | AC | 617 ms
5,284 KB |
testcase_39 | AC | 2 ms
4,380 KB |
testcase_40 | AC | 2 ms
4,376 KB |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int dist(pair<int, int>a, pair<int, int>b) { return (a.first - b.first)*(a.first - b.first) + (a.second - b.second)*(a.second - b.second); } int main() { int n;cin >> n; vector<pair<pair<int, int>, int>>sorted_pos; vector<pair<int, int>>pos; for (int i = 0;i < n;i++) { int x, y;cin >> x >> y; pos.push_back(make_pair(x, y)); sorted_pos.push_back(make_pair(make_pair(x, y), i)); } sort(sorted_pos.begin(), sorted_pos.end()); vector<int>sorted_index(n); for (int i = 0;i < n;i++) { sorted_index[sorted_pos[i].second] = i; } vector<bool>exist(n, true); for (int i = 0;i < n;i++) { int pos = sorted_index[i]; if (exist[pos] == false)continue; for (int j = pos + 1;j < sorted_pos.size();j++) { if (dist(sorted_pos[j].first, sorted_pos[pos].first) >= 400) { if (sorted_pos[j].first.first - sorted_pos[pos].first.first > 20)break; continue; } else exist[j] = false; } for (int j = pos - 1;j >= 0;j--) { if (dist(sorted_pos[j].first, sorted_pos[pos].first) >= 400) { if (sorted_pos[pos].first.first - sorted_pos[j].first.first > 20)break; continue; } else exist[j] = false; } } int cnt = 0; for (int i = 0;i < n;i++) { if (exist[i])cnt++; } cout << cnt << endl; return 0; }