Submission #660753

# Submission time Handle Problem Language Result Execution time Memory
660753 2022-11-23T06:43:27 Z Koful123 Lutrija (COCI19_lutrija) C++17
0 / 70
76 ms 320 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

void solve(){

	int a,b;
	cin >> a >> b;

	vector<int> v(4),num(4);
	for(int i = 0; i < 4; i++){
		num[i] = b + (i - 2 + (i >= 2)) * 2;
		v[i] = prime(num[i]);
	}

	if(v[0] && v[1] && prime(abs(num[0] - a))){
		cout << "4\n" << a << ' ' << num[0] << ' ' << num[1] << ' ' << b << endl;
	}
	else if(v[1] && prime(abs(num[1] - a))){
		cout << "3\n" << a << ' ' << num[1] << ' ' << b << endl;
	}
	else if(v[2] && v[3] && prime(abs(num[3] - a))){
		cout << "4\n" << a << ' ' << num[3] << ' ' << num[2] << ' ' << b << endl; 
 	}
	else if(v[2] && prime(abs(num[2] - a))){
		cout << "3\n" << a << ' ' << num[2] << ' ' << b << endl;
	}
	else cout << -1 << endl;
}
 
signed main(){	
 		
	ios::sync_with_stdio(0);
	cin.tie(0);
 
	int t = 1;
//	cin >> t;
 
	while(t--)
		solve();
 
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 76 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 73 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -