Task: | Neliöt |
Sender: | Lieska |
Submission time: | 2020-11-06 18:15:52 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 28 |
#2 | ACCEPTED | 72 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.43 s | 1, 2 | details |
#2 | ACCEPTED | 0.42 s | 1, 2 | details |
#3 | ACCEPTED | 0.86 s | 2 | details |
Code
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll t[44000]; map<ll, ll> m; void testi(){ ll n; cin >> n; for (int i=0; i<=22361; ++i){ if (m[n-t[i]]) { cout << "YES\n"; return; } } cout << "NO\n"; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); //Älä käytä, jos tehtävä on interaktiivinen! for (int i=0; i<=40000; ++i){ t[i]=i*i; m[i*i]=1; } int t; cin >> t; while (t--) testi(); }
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 |