# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
199482 |
2020-02-01T14:34:05 Z |
44442 |
Lutrija (COCI19_lutrija) |
C++11 |
|
202 ms |
380 KB |
#include <bits/stdc++.h>
using namespace std;
long long a,b,am2,ap2,bm2,bp2;
bool pr(long long n){
for(long long i=2;i*i<=n;i++){
if(!(n%i)) return 0;
// cout<<"ok";
}
return 1;
}
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>a>>b;
if(pr(a-2)){
am2=1;
}
if(pr(a+2)){
ap2=1;
}
if(!am2 and !ap2){
cout<<-1;
return 0;
}
if(pr(b-2)){
bm2=1;
}
if(pr(b+2)){
bp2=1;
}
if(!am2 and !ap2){
cout<<-1;
return 0;
}
if(a==2){
if(bm2){
cout<<2<<endl<<2<<" "<<b;
}
else{
cout<<3<<endl<<2<<" "<<b+2<<" "<<b;
}
}
else if(b==2){
if(bm2){
cout<<2<<endl<<a<<" "<<2;
}
else{
cout<<3<<endl<<a<<" "<<a+2<<" "<<2;
}
}
else if(ap2 and bp2){
cout<<5<<endl<<a<<" "<<a+2<<" "<<2<<" "<<b+2<<" "<<b;
}
else if(am2 and bp2){
cout<<4<<endl<<a<<" "<<2<<" "<<b+2<<" "<<b;
}
else if(ap2 and bm2){
cout<<4<<endl<<a<<" "<<a+2<<" "<<2<<" "<<b;
}
else if(am2 and bm2){
cout<<3<<endl<<a<<" "<<2<<" "<<b;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
380 KB |
Output is correct |
3 |
Correct |
5 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
12 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
6 ms |
376 KB |
Output is correct |
4 |
Correct |
5 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
168 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
202 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
163 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
147 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
180 ms |
380 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
135 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
135 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
376 KB |
Output is correct |
3 |
Correct |
52 ms |
376 KB |
Output is correct |