Submission #251509

#TimeUsernameProblemLanguageResultExecution timeMemory
251509MrRobot_28Lutrija (COCI19_lutrija)C++17
0 / 70
78 ms384 KiB
#include<bits/stdc++.h> using namespace std; #define int long long signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int a, b; cin >> a >> b; bool tr1 = false; if(a > b) { tr1 = true; swap(a, b); } if(a == 2) { bool fl1 = true; bool fl2 = true; for(int j = 2; j * j <= (b - 2); j++) { if((b - 2) % j == 0) { fl1 = false; } } for(int j = 2; j * j <= b + 2; j++) { if((b + 2) % j == 0) { fl2 = false; } } if(tr1) { swap(a, b); } if(fl2) { cout << 3 << "\n"; cout << a << " " << a + b << " " << b; } else if(fl1) { cout << 2 << "\n"; cout << a << " " << b; } else { cout << -1; } return 0; } int t = a + 2; while(t <= b) { for(int j = 2; j * j <= t; j++) { if(t % j == 0) { cout << -1; return 0; } } t += 2; } cout << (b - a) / 2 + 1 << "\n"; if(tr1) { for(int i = b; i >= a; i -= 2) { cout << i << " "; } } else { for(int i = a; i <= b; i += 2) { cout << i << " "; } } 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...