Task: | Alkuluvut |
Sender: | tykkipeli |
Submission time: | 2025-09-27 21:51:51 +0300 |
Language: | C++ (C++20) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
#3 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | 1, 2, 3 | details |
#2 | WRONG ANSWER | 0.01 s | 2, 3 | details |
#3 | ACCEPTED | 0.07 s | 3 | details |
Compiler report
input/code.cpp: In function 'bool brute(std::vector<long long int>&, ll)': input/code.cpp:16:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 16 | for (int i = 0; i < q.size(); i++) { | ~~^~~~~~~~~~
Code
#include <bits/stdc++.h> using namespace std; typedef long long ll; bool is_prime(ll x) { for (ll i = 2; i*i <= x; i++) { if (x%i == 0) return false; } return true; } bool brute(vector<ll> &v, ll base) { vector<ll> q; q.push_back(base); for (int i = 0; i < q.size(); i++) { base = q[i]; for (ll x : v) { ll newbase = base * 10; newbase += x; if (newbase > (ll) 1e16) continue; if (is_prime(newbase)) { cout << "YES\n"; cout << newbase << "\n"; return true; } q.push_back(newbase); } } return false; } void testCase() { int k; cin >> k; vector<ll> v; bool fine = false; bool fine2 = false; for (int i = 0; i < k; i++) { int d; cin >> d; if (d%3 != 0) fine = true; if (d%2 != 0 && d != 5) fine2 = true; v.push_back(d); } if (!fine || !fine2) { cout << "NO\n"; return; } ll base = 0; bool haszero = false; for (ll x : v) { if (x == 0) { haszero = true; } else { base *= 10; base += x; } } if (haszero) base *= 10; if (!brute(v, base)) cout << "NO\n"; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int t; cin >> t; for (int i = 0; i < t; i++) { testCase(); } }
Test details
Test 1
Group: 1, 2, 3
Verdict: WRONG ANSWER
input |
---|
10 1 0 1 1 ... |
correct output |
---|
NO YES 11 YES 2 ... |
user output |
---|
NO YES 11 NO NO ... |
Test 2
Group: 2, 3
Verdict: WRONG ANSWER
input |
---|
175 1 0 1 1 ... |
correct output |
---|
NO YES 11 YES 2 ... |
user output |
---|
NO YES 11 NO NO ... |
Test 3
Group: 3
Verdict: ACCEPTED
input |
---|
848 4 0 1 2 3 4 0 1 2 4 ... |
correct output |
---|
YES 10223 YES 4021 YES ... |
user output |
---|
YES 12301 YES 12401 YES ... |