CSES - Putka Open 2020 – 4/5 - Results
Submission details
Task:Neliöt
Sender:rasastusni
Submission time:2020-11-07 21:02:53 +0200
Language:C++ (C++17)
Status:READY
Result:28
Feedback
groupverdictscore
#1ACCEPTED28
#20
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 2details
#2ACCEPTED0.01 s1, 2details
#3--2details

Code

#include <iostream>

using namespace std;

bool solve(int n) {
	for (int d = 2; ; ++d) {
		int c = 0;
		while (n % d == 0) {
			n /= d;
			++c;
		}
		if (d % 4 == 3 && c % 2 == 1) {
			return false;
		}
		if (n == 1) return true;
	}
}

int main()
{
	int t;
	cin >> t;
	for (int i = 0; i < t; ++i) {
		int n;
		cin >> n;
		cout << (solve(n) ? "YES" : "NO") << endl;
	}
}

/*
int main()
{
	for (int i = 1; i < 100; ++i) {
		if (solve(i)) cout << i << endl;
	}
}
*/

Test details

Test 1

Group: 1, 2

Verdict: ACCEPTED

input
100
1
2
3
4
...

correct output
YES
YES
NO
YES
YES
...

user output
YES
YES
NO
YES
YES
...
Truncated

Test 2

Group: 1, 2

Verdict: ACCEPTED

input
100
522
419
402
969
...

correct output
YES
NO
NO
NO
NO
...

user output
YES
NO
NO
NO
NO
...
Truncated

Test 3

Group: 2

Verdict:

input
100
575833539
744851460
436154655
655319365
...

correct output
NO
NO
NO
NO
NO
...

user output
(empty)