CSES - HIIT Open 2018 - Results
Submission details
Task:Alien Invasion
Sender:Puhi~
Submission time:2018-05-26 13:08:09 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.01 sdetails
#3ACCEPTED0.01 sdetails
#4ACCEPTED0.01 sdetails
#5ACCEPTED0.01 sdetails
#6ACCEPTED0.02 sdetails
#7ACCEPTED0.01 sdetails
#8ACCEPTED0.01 sdetails
#9ACCEPTED0.01 sdetails
#10ACCEPTED0.01 sdetails
#11ACCEPTED0.02 sdetails
#12ACCEPTED0.01 sdetails
#13ACCEPTED0.01 sdetails
#14ACCEPTED0.01 sdetails
#15ACCEPTED0.01 sdetails
#16ACCEPTED0.01 sdetails
#17ACCEPTED0.01 sdetails
#18ACCEPTED0.01 sdetails
#19ACCEPTED0.01 sdetails
#20--details
#21--details
#22--details

Code

#include <iostream>
#include <cmath>

using namespace std;

bool brute(unsigned long long n) {
    unsigned long long count = 0;
    for (unsigned long long i = 1; i <= n; i++) {
        if (n % i == 0) {
            count++;
        }
    }
    
    return count % 2 == 1;
}

bool less_brutal(unsigned long long n) {
    for (unsigned long long i = 1; i <= sqrt(n)+1; i++) {
        if (i*i == n) {
            return true;
        }
    }
    return false;
}

int main() {
    unsigned long long n;
    cin >> n;

    /*for (unsigned long long i = 20000000000; ; i++) {
        cout << i << '\n';
        if (brute(i) != less_brutal(i)) {
            return 0;
        }
    }*/

    if (less_brutal(n)){
        cout << "odd" << endl;
    } else {
        cout << "even" << endl;
    }
    return 0;
}

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:

input
999999874000003969

correct output
odd

user output
(empty)

Test 21

Verdict:

input
999999999999999989

correct output
even

user output
(empty)

Test 22

Verdict:

input
1000000000000000000

correct output
odd

user output
(empty)