Submission #335237

#TimeUsernameProblemLanguageResultExecution timeMemory
335237CaroLindaLutrija (COCI19_lutrija)C++14
42 / 70
96 ms452 KiB
#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) ; }

Compilation message (stderr)

lutrija.cpp: In function 'int main()':
lutrija.cpp:66:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   66 |  scanf("%lld %lld", &A, &B) ;
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~
#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...