# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
542747 |
2022-03-27T20:53:19 Z |
itiam |
Lutrija (COCI19_lutrija) |
C++11 |
|
178 ms |
340 KB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const char r=' ';
const char en='\n';
int prosti(ll a){
if(a<=1) return 0;
for (ll i=2;i*i<=a;i++){
if (a%i==0) return 0;
}
return 1;
}
int main(){
ll a,b;
cin >> a >> b;
if (a==2){
if (prosti(b+2)){
cout << 3 << en << a << r << b+2 << r<< b;
return 0;
}
if (prosti(b-2)){
cout << 2 << en << a << r << b;
return 0;
}
cout << -1;
return 0;
}
if (b==2){
if (prosti(a+2)){
cout << 3 << en << a << r << a+2 << r<< b;
return 0;
}
if (prosti(a-2)){
cout << 2 << en << a << r << b;
return 0;
}
cout << -1;
return 0;
}
if (prosti(a+2)){
if (prosti(b+2)){
cout << 5 << en << a << r << a+2 << r << 2 << r<< b+2 << r<< b;
return 0;
}
if (prosti(b-2)){
cout << 4 << en << a << r << a+2 << r << 2 << r<< b;
return 0;
}
cout << -1;
return 0;
}
if (prosti(a-2)){
if (prosti(b+2)){
cout << 4 << en << a << r << 2 << r<< b+2 << r<< b;
return 0;
}
if (prosti(b-2)){
cout << 3 << en << a << r << 2 << r<< b;
return 0;
}
cout << -1;
return 0;
}
cout << -1;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
308 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
304 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
312 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
147 ms |
284 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
178 ms |
280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
142 ms |
284 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
126 ms |
280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
160 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
308 KB |
Output is correct |
3 |
Correct |
115 ms |
280 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
113 ms |
280 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
43 ms |
212 KB |
Output is correct |