結果
問題 | No.1666 累乗数 |
ユーザー | chocorusk |
提出日時 | 2021-09-03 21:37:51 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 88 ms / 2,000 ms |
コード長 | 1,668 bytes |
コンパイル時間 | 3,424 ms |
コンパイル使用メモリ | 191,068 KB |
実行使用メモリ | 14,088 KB |
最終ジャッジ日時 | 2023-08-21 20:22:41 |
合計ジャッジ時間 | 6,117 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 82 ms
12,944 KB |
testcase_01 | AC | 86 ms
13,564 KB |
testcase_02 | AC | 85 ms
12,752 KB |
testcase_03 | AC | 85 ms
12,600 KB |
testcase_04 | AC | 84 ms
13,824 KB |
testcase_05 | AC | 85 ms
12,660 KB |
testcase_06 | AC | 86 ms
12,420 KB |
testcase_07 | AC | 84 ms
12,548 KB |
testcase_08 | AC | 84 ms
14,088 KB |
testcase_09 | AC | 86 ms
12,912 KB |
testcase_10 | AC | 86 ms
12,904 KB |
testcase_11 | AC | 85 ms
12,384 KB |
testcase_12 | AC | 86 ms
12,860 KB |
testcase_13 | AC | 88 ms
13,704 KB |
testcase_14 | AC | 86 ms
12,652 KB |
testcase_15 | AC | 87 ms
13,048 KB |
testcase_16 | AC | 85 ms
13,232 KB |
testcase_17 | AC | 85 ms
12,500 KB |
testcase_18 | AC | 85 ms
13,636 KB |
testcase_19 | AC | 86 ms
13,220 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; }