# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
335237 | CaroLinda | Lutrija (COCI19_lutrija) | C++14 | 96 ms | 452 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define sz(x) (int)(x.size() )
#define ll long long
using namespace std ;
bool isPrime(ll x)
{
if(x <= 1LL ) return false ;
for(ll i = 2 ; i*i <= x ; i++ )
if( x%i == 0 ) return false ;
return true ;
}
void giveAns(vector<int> &ans )
{
if(sz(ans) == 1 ) printf("%d\n", ans[0] ) ;
else
{
printf("%d\n", sz(ans) ) ;
for(auto e : ans ) printf("%d ", e ) ;
printf("\n") ;
}
exit(0) ;
}
void solve( int B , vector<int> &ans )
{
if(B == 2)
{
ans.push_back(2) ;
ans.push_back(5) ;
ans.push_back(2) ;
giveAns(ans) ;
}
if( isPrime(B-2) )
{
ans.push_back( 2 ) ;
ans.push_back( B ) ;
giveAns(ans) ;
}
if( isPrime(B+2) )
{
ans.push_back(2) ;
ans.push_back(B+2) ;
ans.push_back(B) ;
giveAns(ans) ;
}
ans = {-1} ;
giveAns(ans) ;
}
int main()
{
ll A , B ;
scanf("%lld %lld", &A, &B) ;
vector<int> ans ;
if(A == 3 )
{
ans.push_back(3) ;
A = 5 ;
}
if(A == 5 )
{
ans.push_back(5) ;
A = 7 ;
}
if( A == 2 ) solve( B, ans) ;
if( isPrime(A-2) )
{
ans.push_back(A) ;
solve(B, ans) ;
}
if( isPrime(A+2) )
{
ans.push_back(A) ;
ans.push_back(A+2) ;
solve(B, ans) ;
}
ans = {-1} ;
giveAns(ans) ;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |