結果
問題 | No.1666 累乗数 |
ユーザー | chocorusk |
提出日時 | 2021-09-03 21:37:51 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 91 ms / 2,000 ms |
コード長 | 1,668 bytes |
コンパイル時間 | 3,973 ms |
コンパイル使用メモリ | 192,880 KB |
実行使用メモリ | 12,704 KB |
最終ジャッジ日時 | 2024-05-09 02:24:43 |
合計ジャッジ時間 | 6,195 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 85 ms
12,572 KB |
testcase_01 | AC | 89 ms
12,572 KB |
testcase_02 | AC | 88 ms
12,704 KB |
testcase_03 | AC | 89 ms
12,700 KB |
testcase_04 | AC | 88 ms
12,572 KB |
testcase_05 | AC | 88 ms
12,700 KB |
testcase_06 | AC | 89 ms
12,576 KB |
testcase_07 | AC | 89 ms
12,700 KB |
testcase_08 | AC | 88 ms
12,700 KB |
testcase_09 | AC | 89 ms
12,572 KB |
testcase_10 | AC | 88 ms
12,572 KB |
testcase_11 | AC | 89 ms
12,700 KB |
testcase_12 | AC | 91 ms
12,572 KB |
testcase_13 | AC | 90 ms
12,700 KB |
testcase_14 | AC | 90 ms
12,704 KB |
testcase_15 | AC | 89 ms
12,508 KB |
testcase_16 | AC | 89 ms
12,700 KB |
testcase_17 | AC | 90 ms
12,572 KB |
testcase_18 | AC | 91 ms
12,572 KB |
testcase_19 | AC | 88 ms
12,696 KB |
ソースコード
#include <cstdio> #include <cstring> #include <iostream> #include <string> #include <cmath> #include <bitset> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <algorithm> #include <complex> #include <unordered_map> #include <unordered_set> #include <random> #include <cassert> #include <fstream> #include <utility> #include <functional> #include <time.h> #include <stack> #include <array> #include <list> #include <atcoder/all> #define popcount __builtin_popcount using namespace std; using namespace atcoder; typedef long long ll; typedef pair<int, int> P; bool sq[1000010]; int main() { int t; cin>>t; using lll=__int128_t; for(int i=1; i*i<=1000000; i++) sq[i*i]=1; vector<ll> v; for(int j=3; j<60; j+=2){ for(int i=1; i<=1000000; i++){ if(sq[i]) continue; lll x=1; for(int k=0; k<j; k++){ x*=i; if(x>1e18)break; } if(x>1e18)break; v.push_back(x); } } sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); while(t--){ ll n; cin>>n; if(n==1){ cout<<1<<endl; continue; } ll l=1, r=1e18; while(r-l>1){ ll m=(l+r)/2; int c=lower_bound(v.begin(), v.end(), m+1)-v.begin(); ll l1=0, r1=1e9+7; while(r1-l1>1){ ll m1=(l1+r1)/2; if(m1*m1<=m) l1=m1; else r1=m1; } l1+=c; if(l1<=n-1) l=m; else r=m; } cout<<r<<endl; } return 0; }