Task: | Alien Invasion |
Sender: | KnowYourArchitecture |
Submission time: | 2018-05-26 11:16:14 +0300 |
Language: | C++ |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.01 s | details |
#2 | ACCEPTED | 0.01 s | details |
#3 | ACCEPTED | 0.02 s | details |
#4 | ACCEPTED | 0.01 s | details |
#5 | ACCEPTED | 0.01 s | details |
#6 | ACCEPTED | 0.01 s | details |
#7 | ACCEPTED | 0.01 s | details |
#8 | ACCEPTED | 0.01 s | details |
#9 | ACCEPTED | 0.01 s | details |
#10 | ACCEPTED | 0.01 s | details |
#11 | ACCEPTED | 0.02 s | details |
#12 | ACCEPTED | 0.01 s | details |
#13 | ACCEPTED | 0.01 s | details |
#14 | ACCEPTED | 0.01 s | details |
#15 | ACCEPTED | 0.02 s | details |
#16 | ACCEPTED | 0.01 s | details |
#17 | ACCEPTED | 0.02 s | details |
#18 | ACCEPTED | 0.01 s | details |
#19 | ACCEPTED | 0.01 s | details |
#20 | ACCEPTED | 0.01 s | details |
#21 | ACCEPTED | 0.01 s | details |
#22 | ACCEPTED | 0.01 s | details |
Code
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef __int128 lll; /* lll powmod(lll a, lll p, lll mod) { if(p==0) return 1; if(p%2==0) { a=powmod(a,p/2,mod); return (a*a)%mod; } } return (a*powmod(a,p-1,mod))%mod); } void step(ll&x, ll n, ll c){x=(lll)((lll)x*(lll)x+(lll)c)%n;} void rFactor(ll n, map<ll, ll>& r) { while(n%2==0) { n/=2;r[2]++; } if(n==1) return; if(isPrime(n))r[n]++; else { while(1){ ll x=rand()%n;ll y=x; ll c=rand()%n; for(ll i=0;i*i<=n;i++){ step(x,n,c);step(x,n,c);step(y,n,c); ll g=__gcd(max(x,y)-min(x,y),n); if(g==n)break; else if(g>1) { rFactor(n/g, r); rFactor(g,r); return; } } } } } map<ll,ll> factor(ll n){ map<ll,ll> ret; if(n>1) rFactor(n,ret); return ret; } */ bool test(ll a) { ll b = (ll)sqrt(a) - 10000; if (b<0) b = 0; ll c = b + 20000; for (ll i = b; i < c; i++) { if (i * i == a) return true; } return false; } int main(){ ll a; cin>>a; if (!test(a)) { cout << "even\n"; } else { cout << "odd\n"; } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 |
correct output |
---|
odd |
user output |
---|
odd |
Test 2
Verdict: ACCEPTED
input |
---|
2 |
correct output |
---|
even |
user output |
---|
even |
Test 3
Verdict: ACCEPTED
input |
---|
3 |
correct output |
---|
even |
user output |
---|
even |
Test 4
Verdict: ACCEPTED
input |
---|
4 |
correct output |
---|
odd |
user output |
---|
odd |
Test 5
Verdict: ACCEPTED
input |
---|
5 |
correct output |
---|
even |
user output |
---|
even |
Test 6
Verdict: ACCEPTED
input |
---|
6 |
correct output |
---|
even |
user output |
---|
even |
Test 7
Verdict: ACCEPTED
input |
---|
7 |
correct output |
---|
even |
user output |
---|
even |
Test 8
Verdict: ACCEPTED
input |
---|
8 |
correct output |
---|
even |
user output |
---|
even |
Test 9
Verdict: ACCEPTED
input |
---|
9 |
correct output |
---|
odd |
user output |
---|
odd |
Test 10
Verdict: ACCEPTED
input |
---|
10 |
correct output |
---|
even |
user output |
---|
even |
Test 11
Verdict: ACCEPTED
input |
---|
11 |
correct output |
---|
even |
user output |
---|
even |
Test 12
Verdict: ACCEPTED
input |
---|
12 |
correct output |
---|
even |
user output |
---|
even |
Test 13
Verdict: ACCEPTED
input |
---|
13 |
correct output |
---|
even |
user output |
---|
even |
Test 14
Verdict: ACCEPTED
input |
---|
14 |
correct output |
---|
even |
user output |
---|
even |
Test 15
Verdict: ACCEPTED
input |
---|
15 |
correct output |
---|
even |
user output |
---|
even |
Test 16
Verdict: ACCEPTED
input |
---|
16 |
correct output |
---|
odd |
user output |
---|
odd |
Test 17
Verdict: ACCEPTED
input |
---|
17 |
correct output |
---|
even |
user output |
---|
even |
Test 18
Verdict: ACCEPTED
input |
---|
18 |
correct output |
---|
even |
user output |
---|
even |
Test 19
Verdict: ACCEPTED
input |
---|
19 |
correct output |
---|
even |
user output |
---|
even |
Test 20
Verdict: ACCEPTED
input |
---|
999999874000003969 |
correct output |
---|
odd |
user output |
---|
odd |
Test 21
Verdict: ACCEPTED
input |
---|
999999999999999989 |
correct output |
---|
even |
user output |
---|
even |
Test 22
Verdict: ACCEPTED
input |
---|
1000000000000000000 |
correct output |
---|
odd |
user output |
---|
odd |