# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
849852 | 2023-09-15T13:11:16 Z | tiwerlol | Lutrija (COCI19_lutrija) | C++17 | 1 ms | 504 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==2 || a==3) return 1; if(a%2==0 || a%3==0 || a%5==0 || a%7==0) return 0; for(ll z = 0; z*z <= a; z+=6) { if((a%(z-1)==0) || (a%(z+1)==0)) return 1; } return 0; } 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Incorrect | 1 ms | 344 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Failed | 1 ms | 344 KB | user found solution while jury couldn't |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 504 KB | Output is correct |