結果
| 問題 |
No.1140 EXPotentiaLLL!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-31 22:02:37 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,230 bytes |
| コンパイル時間 | 2,168 ms |
| コンパイル使用メモリ | 204,884 KB |
| 最終ジャッジ日時 | 2025-01-12 10:08:39 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 6 WA * 6 |
コンパイルメッセージ
main.cpp: In function ‘std::vector<long long int> sieve(ll)’:
main.cpp:26:15: warning: left shift count >= width of type [-Wshift-count-overflow]
26 | rep(i,0,(1<<60)){
| ~^~~~
main.cpp:8:36: note: in definition of macro ‘rep’
8 | #define rep(i,m,n) for(ll i=(m);i<(n);i++)
| ^
ソースコード
/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
vector<ll> sieve(ll n){ //エラトステネス
vector<bool> is_prime(n+1);
vector<ll> prime;
rep(i,0,n+1) is_prime[i] = true;
is_prime[0] = is_prime[1] = false;
rep(i,2,n+1){
if(is_prime[i]){
prime.push_back(i);
for(int j = 2 * i; j <= n; j += i) is_prime[j] = false;
}
}
return prime;
rep(i,0,(1<<60)){
print(i);
}
}
vector<ll> primes = sieve(5000000);
void solve(){
map<int,bool> mp;
for(auto &e: primes) mp[e] = true;
ll T;
cin >> T;
while(T--){
ll A,P;
cin >> A >> P;
if(not mp[P]){
print(-1);
}else{
print(1);
}
}
}
int main(){
cin.tie(0);
ios::sync_with_stdio(false);
solve();
}