Submission #666598

# Submission time Handle Problem Language Result Execution time Memory
666598 2022-11-29T06:56:40 Z Koful123 Lutrija (COCI19_lutrija) C++17
0 / 70
83 ms 324 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;

	if(prime(abs(a-b))){
		cout << a << ' ' << b << endl;
		return;
	}

	if(a > b){
		if(prime(a-2) && prime(abs(a-2 - b))){
			cout << a << ' ' << a - 2 << ' ' << b << endl;
		}
		if(prime(a+2) && prime(a+2 - b)){
			cout << a << ' ' << a + 2 << ' ' << b << endl;
		}
		else cout << -1 << endl;
	}
	else{
		if(prime(b-2) && prime(abs(b-2 - a))){
			cout << a << ' ' << b - 2 << ' ' << b << endl;
		}
		if(prime(b+2) && prime(b+2 - a)){
			cout << a << ' ' << b + 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 1 ms 212 KB Integer parameter [name=arr[3]] equals to -1, violates the range [1, 1000000000000000]
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 324 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 4 ms 292 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 77 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 72 ms 296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 82 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 83 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -