Submission #244257

# Submission time Handle Problem Language Result Execution time Memory
244257 2020-07-03T11:58:21 Z erray Lutrija (COCI19_lutrija) C++14
7 / 70
5 ms 384 KB
#include<bits/stdc++.h>

using namespace std;

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	auto isPrime = [&](long long num) {
		if (num < 2) return false;
		for (long long i = 2; i * i <= num; ++i) if (num % i == 0) return false;
		return true;
	};
	long long a, b;
	cin >> a >> b;
	if (isPrime(abs(a - b))) cout << 2 << '\n' << a << ' ' << b;
	else if (isPrime(a - 2) && isPrime(b - 2)) cout << 3 << '\n' << a << " 2 " << b;
	else if (isPrime(a + b)) cout << 3 << '\n' << a << ' ' << a + b << ' ' << b;
	else if (a == 2 && b == 2) cout << "3\n2 5 2";
	else cout << -1;
}	
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 5 ms 308 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -