| Task: | Alkuluvut |
| Sender: | pupukani |
| Submission time: | 2025-09-28 16:50:33 +0300 |
| Language: | Python3 (PyPy3) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | RUNTIME ERROR | 0 |
| #2 | RUNTIME ERROR | 0 |
| #3 | RUNTIME ERROR | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | RUNTIME ERROR | 0.07 s | 1, 2, 3 | details |
| #2 | RUNTIME ERROR | 0.06 s | 2, 3 | details |
| #3 | RUNTIME ERROR | 0.06 s | 3 | details |
Code
import math
def on_alkuluku(luku):
if luku == 1:
return False
if luku == 2:
return True
for i in range(2, math.sqrt(luku)):
if luku % i == 0:
return False
return True
def tee_alkuluku(luku, numerot):
if len(luku) > 0 and int(luku) > 10 ** 16:
return 0
if len(luku) > 0 and on_alkuluku(int(luku)):
return luku
for i in range(0, len(numerot)):
luku = luku + numerot[i];
ret = tee_alkuluku(luku, numerot)
if ret != 0:
return ret;
luku = luku[:-1]
return 0
def main():
t = int(input())
tuloste = ""
for i in range(t):
k = int(input())
rivi = input()
numerot = rivi.split()
alkuluku = int(tee_alkuluku("", numerot))
if alkuluku == 0:
tuloste = tuloste + "NO\n"
else:
tuloste = tuloste + "YES\n"
tuloste = tuloste + str(alkuluku) + "\n";
print(tuloste)
main()
Test details
Test 1
Group: 1, 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 10 1 0 1 1 ... |
| correct output |
|---|
| NO YES 11 YES 2 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 41, in <module>
main()...Test 2
Group: 2, 3
Verdict: RUNTIME ERROR
| input |
|---|
| 175 1 0 1 1 ... |
| correct output |
|---|
| NO YES 11 YES 2 ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 41, in <module>
main()...Test 3
Group: 3
Verdict: RUNTIME ERROR
| input |
|---|
| 848 4 0 1 2 3 4 0 1 2 4 ... |
| correct output |
|---|
| YES 10223 YES 4021 YES ... |
| user output |
|---|
| (empty) |
Error:
Traceback (most recent call last):
File "input/code.py", line 41, in <module>
main()...