CSES - Putka Open 2020 – 4/5 - Results
Submission details
Task:Neliöt
Sender:mangolassi
Submission time:2020-11-08 08:05:08 +0200
Language:C++ (C++11)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED28
#2ACCEPTED72
Test results
testverdicttimegroup
#1ACCEPTED0.02 s1, 2details
#2ACCEPTED0.02 s1, 2details
#3ACCEPTED0.02 s2details

Code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);

	int t;
	cin >> t;
	for (int ti = 0; ti < t; ++ti) {
		ll v;
		cin >> v;

		bool fail = 1;
		ll b = 1e5;
		for (ll a = 1; a*a <= v; ++a) {
			while(a*a + b*b > v) --b;
			if (a*a + b*b == v) fail = 0;
		}
		if (fail) cout << "NO\n";
		else cout << "YES\n";
	}
}

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: ACCEPTED

input
100
575833539
744851460
436154655
655319365
...

correct output
NO
NO
NO
NO
NO
...

user output
NO
NO
NO
NO
NO
...
Truncated