Submission
Id | When | Author | Problem | Language | CPU | Memory | Verdict |
---|---|---|---|---|---|---|---|
16910 | 2024-04-23 00:27:03 | zunayed | Binary Prime | C++ 17 | 46 ms | 3592 kb | Wrong Answer - 9 |
Test Cases
CPU | Memory | Verdict | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
1 | 45 ms | 3396 kb | Accepted | ||||||||
2 | 45 ms | 3592 kb | Accepted | ||||||||
3 | 45 ms | 3448 kb | Accepted | ||||||||
4 | 45 ms | 3516 kb | Accepted | ||||||||
5 | 45 ms | 3440 kb | Accepted | ||||||||
6 | 45 ms | 3536 kb | Accepted | ||||||||
7 | 45 ms | 3516 kb | Accepted | ||||||||
8 | 45 ms | 3444 kb | Accepted | ||||||||
9 | 46 ms | 3352 kb | Wrong Answer | ||||||||
10 | - | - | Skipped | ||||||||
11 | - | - | Skipped | ||||||||
Source Code
program.cpp
/* ...Bismillahir Rahmanir Raheem... */ /* Problem: binary_prime Date: 2024-Apr-23 */ #include<bits/stdc++.h> using namespace std; #define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define all(a) (a).begin(),(a).end() #define nl cout<<'\n' ; #define out(a) cout<<a<<'\n'; #define hmm(ok) cout<<(ok==1?"YES":"NO")<<'\n'; #define ld long double #define ll long long #define ull unsigned long long const ld PI = 3.141592653589793238462; const ll MOD = 1e9+7; const ll INF = 1e18; const int N=1e6; vector<bool>prime(N+1,true); void sieve() { for (int p = 2; p * p <= N; p++) { if (prime[p]) { for (int i = p * p; i <= N; i += p) prime[i] = false; } } } void solve() { int n; cin>>n; bitset<64>keep(n); int cnt=0; for(int i=0; i<64; i++) { if(keep.test(i)) { cnt++; } } if(prime[cnt] and cnt!=1) { out("Binary prime"); } else{ out(-1) } } int main() { faster; sieve(); int test; cin>>test; int i=1; while(test--){ solve(); //cout<<"Case "<<i++<<":"; } }