Submission #62809
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | //header{{{ #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #include <ext/pb_ds/tag_and_trait.hpp> #include <ext/pb_ds/trie_policy.hpp> using namespace __gnu_pbds; using namespace std; #define rep(i,n) for(int i=0;i<(n);++i) #define reps(i,n) for(int i=1;i<=(n);++i) #define all(x) (x).begin(),(x).end() #define Fixed fixed << setprecision(12) #define int int_fast64_t using pii = pair< int , int >; constexpr int INF = 0x3f3f3f3f; constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL; constexpr int mod1 = 1e9+7; constexpr int mod2 = 998244353; template < class Func> class FixPoint : Func { public : explicit constexpr FixPoint(Func&& f) noexcept : Func(forward<Func>(f)) {} template < class ... Args> constexpr decltype(auto) operator()(Args&&... args) const { return Func::operator()(* this , std::forward<Args>(args)...); } }; template < class Func> static inline constexpr decltype(auto) makeFixPoint(Func&& f) noexcept { return FixPoint<Func>{forward<Func>(f)}; } template < class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true ); } template < class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true ); } template < class T> using min_heap = priority_queue<T,vector<T>,greater<T> >; template < class T> using max_heap = priority_queue<T>; template < class A, class B> using umap = unordered_map<A,B>; template < class T> using Set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template < class K, class V> using Umap = gp_hash_table<K, V>; using Trie = trie<string, null_type, trie_string_access_traits<>, pat_trie_tag, trie_prefix_search_node_update>; template < class T> inline int square( const T &a){ return (a * a); } inline int updiv( int a, int b){ return (a + b - 1) / b; } constexpr int dx[] = {1,0,-1,0,1,1,-1,-1}; constexpr int dy[] = {0,-1,0,1,1,-1,-1,1}; //}}} signed main(){ cin.tie(nullptr); ios_base::sync_with_stdio( false ); cout.setf(ios_base::fixed); cout.precision(10); int t; cin >> t; vector<tuple< int , int , int > > querys; vector< double > res(t); rep(i,t){ int l, k; cin >> l >> k; querys.emplace_back(l, k, i); } sort(all(querys)); int nl = 0, cnt = 0; Set<pair< int , int > > s; for (auto&& [l, k, query_num] : querys){ for (nl; nl <= l; ++nl){ for ( int i = 0; i < nl; ++i){ s.insert({square(i) + square(nl), cnt}); ++cnt; s.insert({square(i) + square(nl), cnt}); ++cnt; } s.insert({square(nl) + square(nl), cnt}); ++cnt; } res[query_num] = sqrt ((*s.find_by_order(k - 1)).first); } for (auto&& e : res){ cout << e << '\n' ; } return 0; } |
ステータス
項目 | データ |
---|---|
問題 | 1353 - Function of Euclidean Distance |
ユーザー名 | ei1903 |
投稿日時 | 2020-08-21 11:51:59 |
言語 | C++17 |
状態 | Accepted |
得点 | 400 |
ソースコード長 | 2964 Byte |
最大実行時間 | 570 ms |
最大メモリ使用量 | 90140 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | task01 | 60 / 60 | in01*, sample01.txt |
2 | task02 | 340 / 340 | * |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | |
---|---|---|---|---|---|
in01_01.txt | AC | 31 ms | 604 KB |
1
|
2
|
in01_02.txt | AC | 361 ms | 63276 KB |
1
|
2
|
in01_03.txt | AC | 20 ms | 472 KB |
1
|
2
|
in01_04.txt | AC | 368 ms | 63144 KB |
1
|
2
|
in01_05.txt | AC | 377 ms | 63188 KB |
1
|
2
|
in01_06.txt | AC | 27 ms | 512 KB |
1
|
2
|
in01_07.txt | AC | 20 ms | 596 KB |
1
|
2
|
in01_08.txt | AC | 24 ms | 680 KB |
1
|
2
|
in01_09.txt | AC | 360 ms | 63352 KB |
1
|
2
|
in01_10.txt | AC | 355 ms | 63016 KB |
1
|
2
|
in02_01.txt | AC | 510 ms | 69192 KB |
2
|
|
in02_02.txt | AC | 495 ms | 71080 KB |
2
|
|
in02_03.txt | AC | 481 ms | 74232 KB |
2
|
|
in02_04.txt | AC | 420 ms | 76764 KB |
2
|
|
in02_05.txt | AC | 74 ms | 15920 KB |
2
|
|
in02_06.txt | AC | 569 ms | 80376 KB |
2
|
|
in02_07.txt | AC | 541 ms | 82772 KB |
2
|
|
in02_08.txt | AC | 543 ms | 85300 KB |
2
|
|
in02_09.txt | AC | 510 ms | 87832 KB |
2
|
|
in02_10.txt | AC | 570 ms | 90140 KB |
2
|
|
sample01.txt | AC | 26 ms | 24332 KB |
1
|
2
|
sample02.txt | AC | 391 ms | 87004 KB |
2
|