Submission #491244

# Submission time Handle Problem Language Result Execution time Memory
491244 2021-12-01T06:57:26 Z Nimbostratus Lutrija (COCI19_lutrija) C++17
0 / 70
1 ms 204 KB
#include "bits/stdc++.h"
#define endl '\n'
const int maxn = 2e5 + 5;
const int inf = 2e9;
const int mod = 1e9 + 7;
using namespace std;
using lint = long long;
using pii = pair<int,int>;

lint a, b;
bool rev;
vector<lint> ans;

bool prime(lint x) {
	if(x <= 1)
		return false;
	for(lint i = 2; i * i <= x; i++)
		if(x % i == 0)
			return false;
	return true;
}

signed main() {
	#ifdef Local
	freopen("in.txt", "r", stdin);
	freopen("out.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> a >> b;
	if(a > b) {
		swap(a, b);
		rev = true;
	}
	ans.push_back(a);
	if(a == 2) {
		if(prime(b + 2))
			ans.push_back(b + 2);
		else if(prime(b - 2) && prime(b - 4))
			ans.push_back(b - 2);
		else if(!prime(b - a)) {
			cout << -1 << endl;
			return 0;
		}
	}
	else if(b - a != 2) {
		cout << -1 << endl;
		return 0;
	}
	ans.push_back(b);
	if(rev)
		reverse(ans.begin(), ans.end());
	cout << ans.size() << endl;
	for(int x : ans)
		cout << x << " ";

}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -