結果
問題 | No.202 1円玉投げ |
ユーザー | tokkaka |
提出日時 | 2016-08-08 22:01:35 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 462 ms / 5,000 ms |
コード長 | 1,595 bytes |
コンパイル時間 | 1,767 ms |
コンパイル使用メモリ | 109,020 KB |
実行使用メモリ | 10,176 KB |
最終ジャッジ日時 | 2023-08-23 23:24:28 |
合計ジャッジ時間 | 8,317 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 335 ms
10,156 KB |
testcase_01 | AC | 255 ms
9,896 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,380 KB |
testcase_05 | AC | 14 ms
4,376 KB |
testcase_06 | AC | 246 ms
8,328 KB |
testcase_07 | AC | 276 ms
8,816 KB |
testcase_08 | AC | 274 ms
8,940 KB |
testcase_09 | AC | 145 ms
6,416 KB |
testcase_10 | AC | 57 ms
4,780 KB |
testcase_11 | AC | 115 ms
5,896 KB |
testcase_12 | AC | 119 ms
5,936 KB |
testcase_13 | AC | 63 ms
4,952 KB |
testcase_14 | AC | 17 ms
4,376 KB |
testcase_15 | AC | 142 ms
6,432 KB |
testcase_16 | AC | 462 ms
10,120 KB |
testcase_17 | AC | 294 ms
10,176 KB |
testcase_18 | AC | 297 ms
10,124 KB |
testcase_19 | AC | 133 ms
6,176 KB |
testcase_20 | AC | 217 ms
7,732 KB |
testcase_21 | AC | 129 ms
6,172 KB |
testcase_22 | AC | 2 ms
4,376 KB |
testcase_23 | AC | 3 ms
4,376 KB |
testcase_24 | AC | 2 ms
4,376 KB |
testcase_25 | AC | 2 ms
4,384 KB |
testcase_26 | AC | 3 ms
4,376 KB |
testcase_27 | AC | 3 ms
4,376 KB |
testcase_28 | AC | 2 ms
4,380 KB |
testcase_29 | AC | 3 ms
4,380 KB |
testcase_30 | AC | 3 ms
4,376 KB |
testcase_31 | AC | 2 ms
4,376 KB |
testcase_32 | AC | 3 ms
4,380 KB |
testcase_33 | AC | 3 ms
4,376 KB |
testcase_34 | AC | 4 ms
4,380 KB |
testcase_35 | AC | 361 ms
10,176 KB |
testcase_36 | AC | 259 ms
10,112 KB |
testcase_37 | AC | 305 ms
9,056 KB |
testcase_38 | AC | 361 ms
10,176 KB |
testcase_39 | AC | 2 ms
4,380 KB |
testcase_40 | AC | 1 ms
4,376 KB |
ソースコード
#include <iostream> #include <sstream> #include <string> #include <vector> #include <functional> #include <tuple> #include <climits> #include <algorithm> #include <queue> #include <unordered_map> #include <unordered_set> #include <set> #include <numeric> #include <map> #include <cmath> #include <cstdlib> #include <iomanip> using namespace std; int main() { int N; cin >> N; vector<int> X(N), Y(N); for(int i=0; i<N; i++) cin >> X[i] >> Y[i]; constexpr int max_x = 20000; constexpr int max_y = 20000; constexpr int bucket_size = 10; using bucket_t = tuple<int, int>; enum { x = 0, y = 1 }; map<tuple<int, int>, bucket_t> bucket; int count = 0; for(int i=0; i<N; i++) { bucket_t b = make_tuple(X[i], Y[i]); tuple<int, int> bp = make_tuple(X[i]/bucket_size, Y[i]/bucket_size); if(bucket.find(bp) != bucket.end()) continue; for(int ix=-2; ix<=2; ix++) { for(int iy=-2; iy<=2; iy++) { tuple<int, int> neighbor = bp; get<x>(neighbor) = get<x>(neighbor) + ix; get<y>(neighbor) = get<y>(neighbor) + iy; if(bucket.find(neighbor) != bucket.end()) { const int squared_distance = pow(get<x>(bucket[neighbor])-get<x>(b), 2) + pow(get<y>(bucket[neighbor])-get<y>(b), 2); if(squared_distance < 400) goto next; } } } bucket[bp] = make_tuple(X[i], Y[i]); count++; next:; } cout << count << endl; }