# HIIT Open 2016

 Start: 2016-05-28 11:00:00 End: 2016-05-28 16:00:00

CSES - HIIT Open 2016 - Results
History
2016-05-28 11:27:15
2016-05-28 11:12:22
2016-05-28 11:09:51
 Task: Interesting number Sender: Noname 01 Submission time: 2016-05-28 11:27:15 Language: C++ Status: READY Result: ACCEPTED

## Test results

 test verdict time (s) #1 ACCEPTED 0.05 / 1.00 details #2 ACCEPTED 0.06 / 1.00 details

## Code

```// NONAME-01

#include <bits/stdc++.h>

using namespace std;

vector <int> a;
int pr[1001];
int pal[1001];

{
int n;
cin >> n;
a.resize(n);
for (int i = 0; i < n; i++)
cin >> a[i];
}

void Solve()
{
int i;
for (i = 0; i < (int)a.size(); i++) {
if (pr[a[i]] == 1 && pal[a[i]] == 1) {
cout << a[i] << "\n";
break;
}
}
}

void Fill() {
int i, j;
pr[1] = 0;
for (i = 2; i <= 1000; i++) {
for (j = 2; j*j <= i && j < i; j++) {
if (i % j == 0) {
pr[i] = -1;
break;
}
}
pr[i]++;
if (i < 10) {
pal[i] = 1;
} else if (i < 100) {
if (i % 10 == i/10) pal[i] = 1;
} else if (i < 1000) {
if (i%10 == i / 100) pal[i] = 1;
}
}
}

int main() {
Fill();
ios_base::sync_with_stdio(0);
cin.tie(0);
int nt, tt;
cin >> nt;
for (tt = 0; tt < nt; tt++) {
Solve();
}
return 0;
}```

## Test details

### Test 1

Verdict: ACCEPTED

input
```1000 9 300 988 956 931 116 3 386 202 ... 8 786 850 344 607 258 3 564 795 7 181 300 325 705 512 972 207 6 919 257 176 534 398 536 9 324 811 467 265 688 191 642 17... 5 7 691 423 512 506 5 705 191 300 735 966 10 134 709 407 211 518 815 444 11... 9 794 476 394 244 671 181 466 92... 6 ...```
view   save

correct output
```3 3 181 919 191 7 191 353 181 929 787 727 7 373 313 2 353 383 787 919 ...```
view   save

user output
```3 3 181 919 191 7 191 353 181 929 787 727 7 373 313 2 353 383 787 919 ...```
view   save

### Test 2

Verdict: ACCEPTED

input
```1 100000 72 247 605 249 10 422 594 490 ...```
view   save

correct output
`191`
view   save

user output
`191`
view   save