Submission #850926

# Submission time Handle Problem Language Result Execution time Memory
850926 2023-09-17T19:52:36 Z dosts Lutrija (COCI19_lutrija) C++14
0 / 70
1 ms 452 KB
#include <bits/stdc++.h>
using namespace std;
#define sp << " " << 
#define int long long
#define vi vector<int>
#define pb push_back
const int N =1e6+1;

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

void solve() {
	int a,b;
	cin >> a >> b;
	bool fl = (a>b);
	if (fl) swap(a,b);
	vi ans;
	if (a == 2) {
		if (prime(b-a)) {
			ans.pb(a);
			ans.pb(b);
		}
		else if (prime(b-a-2)) {
			ans.pb(a);
			ans.pb(b-2);
			ans.pb(b);
		}
		else if (prime(b-a+2)) {
			ans.pb(a);
			ans.pb(b+2);
			ans.pb(b);
		}
		else {
			cout << -1 << endl;
			return;
		}
	}
	else {
		if (a == 3 && b == 7) {
			cout << 3 << endl << 3 sp 5 sp 7 << endl;
			return;
		}
		if (b-a >= 4) {
			cout << -1 << endl;
			return;
		}
		cout << 2 << endl;
		if (!fl) cout << a sp b << endl;
		else cout << b sp a << endl;
		return;
	}
	cout << ans.size() << endl;
	cout << fl << endl;
	if (fl) reverse(ans.begin(),ans.end());
	for (auto it : ans) cout << it << " ";
	cout << endl;
}    




                                
signed main() { 
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t = 1;
    //cin >> t; 
    while (t --> 0) solve();
}



# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer parameter [name=arr[1]] equals to 0, violates the range [1, 1000000000000000]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 452 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -