Submission #250614

# Submission time Handle Problem Language Result Execution time Memory
250614 2020-07-18T14:05:55 Z REALITYNB Lutrija (COCI19_lutrija) C++14
14 / 70
2 ms 512 KB
#include <bits/stdc++.h> 
using namespace std ; 
bool check(int i){
		bool prime= 1 ; 
		for(int j=2;j*j<=i;j++){
			if(i%j==0){
				prime = 0; 
			}
		}
		return prime ;  
}
int main(){
	int a , b ; 
	cin>>a>>b ; 
	vector<int> p ;  
	vector<int> isp(1001)  ; 
	for(int i=2;i<=1000;i++){
		bool prime= check(i) ;
		isp[i] = prime ;  
		if(prime) p.push_back(i) ; 
	}
	if(isp[abs(a-b)]){
		cout << 2 << endl ; 
		cout << a << " " << b ; 
		return 0 ;
	}
	for(int i=1;i<1001;i++){
		if(isp[i]==0) continue ; 
		int x = i ; 
		int dif = abs(x-a) , diff = abs(x-b) ; 
		if(isp[dif]&&isp[diff]){
			cout << 3 << endl ; 
			cout << a << " "<< x << " "<< b ; 
			return 0 ; 
		} 
	}
	cout << -1 ; 
	return 0 ; 
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 0 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 384 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -