# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
849859 | 2023-09-15T13:17:13 Z | tiwerlol | Lutrija (COCI19_lutrija) | C++17 | 48 ms | 596 KB |
#include <bits/stdc++.h> using namespace std; ofstream fout("xor.out"); ifstream fin("xor.in"); #define miauDebug #ifdef miauDebug #define mau(x) MIAUMIAU(#x, x) #else #define mau(x) #endif void MIAUMIAU(const char* var_name, auto var_value) { cout << var_name << " = " << var_value << endl; } using ll = long long; const int nM = 2e5+5; const ll MOD = 1e9 + 7; // :3 bool prim(ll a) { if(a==1||a==0) return 0; if(a==2 || a==3 || a==5 || a==7) return 1; if(a%2==0 || a%3==0 || a%5==0 || a%7==0) return 0; for(ll z = 6; z*z <= a; z+=6) { if((a%(z-1)==0) || (a%(z+1)==0)) return 0; } return 1; } void solve() { ll a, b; cin >> a >> b; if(prim(abs(a-b))) { cout << 2 << '\n'; cout << a << ' ' << b << '\n'; return; } if(a==2) { if(prim(b+2)) cout << 3 << '\n' << a << ' ' << b+2 << ' ' << b; else cout << -1 << '\n'; return; } if(b==2) { if(prim(a+2)) cout << 3 << '\n' << a << ' ' << a+2 << ' ' << b; else cout << -1 << '\n'; return; } if(prim(a-2) && prim(b-2)) { cout << 3 << '\n'; cout << a << ' ' << 2 << ' ' << b; return; } if(prim(a-2) && prim(b+2)) { cout << 4 << '\n'; cout << a << ' ' << 2 << ' ' << b+2 << ' ' << b; return; } if(prim(a+2) && prim(b-2)) { cout << 4 << '\n'; cout << a << ' ' << a+2 << ' ' << 2 << ' ' << b; return; } if(prim(a+2) && prim(b+2)) { cout << 5 << '\n'; cout << a << ' ' << a+2 << ' ' << 2 << ' ' << b+2 << ' ' << b; return; } cout << "-1"; } signed main() { cout.tie(NULL); cin.tie(NULL); ios_base::sync_with_stdio(false); int tt = 1; //cin >> tt; while(tt--) solve(); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 42 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 596 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 436 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 436 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |