답안 #250589

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
250589 2020-07-18T13:11:37 Z REALITYNB Lutrija (COCI19_lutrija) C++14
7 / 70
1 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 ; 
	if(a>b) swap(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& x : p){
		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 ; 
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 -
# 결과 실행 시간 메모리 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 -