Submission #250636

#TimeUsernameProblemLanguageResultExecution timeMemory
250636REALITYNBLutrija (COCI19_lutrija)C++14
0 / 70
79 ms360 KiB
#include <bits/stdc++.h> #define int long long bool check(int i){ bool prime= 1 ; for(int j=2;j*j<=i;j++){ if(i%j==0){ prime = 0; } } return prime ; } using namespace std; signed main(){ int a , b ; cin>>a>>b ; if(abs(b-a)==2){ cout << 2 << endl << a << " "<< b ; return 0 ; } if(a>2&&b>2){ if(check(min(a,b)+2)&&abs(b-a)==4)cout << 3 << endl << a << " " << min(a,b)+2 << " " << b ; else cout << -1 ; return 0 ; /*int flg = 0 ; if(a>b){ swap(a,b) ; flg = 1 ; } vector<int> ans ; ans.push_back(a) ; while(a!=b){ if((int)(ans.size())>30){ cout << -1 ; return 0 ; } a+=2 ; ans.push_back(a) ; if(check(a)^1){ cout << -1 ; return 0 ; } } if((int)(ans.size())>30){ cout << -1 ; return 0 ; } if(flg) reverse(ans.begin(),ans.end()) ; cout << ans.size() << endl ; for(int& x :ans) cout << x << (x!=ans.back()?" ":"") ; */ } if(check(abs(a-b))){ cout << 2 << endl ; cout << a << " " << b ; return 0 ; } if(check(max(a,b)+2)){ cout << 3 << endl ; cout << a << " " << max(a,b)+2 << " " << b ; return 0 ; } cout << -1 ; return 0 ; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...