# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
339012 | 2020-12-24T11:21:35 Z | A_D | Lutrija (COCI19_lutrija) | C++14 | 85 ms | 20480 KB |
#include <bits/stdc++.h> #define ll long long #define F first #define S second using namespace std; const ll N=1e3+10; const ll M=1e7+110; vector<int> p; bool dp[N][N][2]; bool b[M]; int sz; bool ok(ll v) { for(ll i=2;i*i<=v;i++){ if(v%i==0)return 0; } return 1; } void sev() { for(int i=2;i<=1e7;i++){ if(b[i]==0){ p.push_back(i); sz++; for(int j=i*i;j<=1e7;j+=i){ b[j]=1; } } } } main() { sev(); ll a,b,q; q=1; while(q--){ cin>>a>>b; if(ok(abs(a-b))){ cout<<2<<endl; cout<<a<<" "<<b<<endl; } if(abs(a-b)%2==0){ cout<<-1; return 0; } for(int i=0;i<sz;i++){ ll v=abs(a-p[i]); v+=abs(b-p[i]); if(ok(v)){ cout<<3<<endl; cout<<a<<" "<<p[i]<<" "<<b<<endl; return 0; } } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 79 ms | 20480 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 80 ms | 20332 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 82 ms | 20332 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 83 ms | 20400 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 83 ms | 20460 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 84 ms | 20364 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 82 ms | 20332 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 79 ms | 20332 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 78 ms | 20332 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 85 ms | 20332 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |