Submission #251505

#TimeUsernameProblemLanguageResultExecution timeMemory
251505MrRobot_28Lutrija (COCI19_lutrija)C++17
0 / 70
81 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; if(a > b) { 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(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"; 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...