Submission #439421

# Submission time Handle Problem Language Result Execution time Memory
439421 2021-06-29T20:35:28 Z Yomapeed Lutrija (COCI19_lutrija) C++17
0 / 70
1 ms 308 KB
#include<bits/stdc++.h>
#define pi 3.141592653589793238
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
 
 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
bool prime(ll n){
    for(ll i = 2; i * i <= n; i++){
        if(n % i == 0){
            return false;
        }
    }
    return true;
} 
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    //cin >> T;
    while (T--) {
        ll l, r;
        cin >> l >> r;
        ll a = 0;
        if(l > r){
            swap(l, r);
            a = 1;
        }
        if(prime(r - l)){
            cout << "2\n";
            if(!a){
                cout << l << " " << r << "\n";
            }
            else{
                cout << r << " " << l << "\n";
            }
        }
        else if(prime(r - 2 - l) && prime(r - 2)){
            cout << "3\n";
            if(!a){
                cout << l << " " <<  r - 2 << " " << r << "\n";
            }
            else{
                cout << r << " " << r - 2 << " " << l << "\n";
            }
        }
        else if(prime(r + 2 - l) && prime(r + 2)){
            cout << "3\n";
            if(!a){
                cout << l << " " <<  r + 2 << " " << r << "\n";
            }
            else{
                cout << r << " " << r + 2 << " " << l << "\n";
            }
        }
        else{
            cout << "-1\n";
        }
    }
    return 0;
}

Compilation message

lutrija.cpp:4: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    4 | #pragma GCC optimization ("O3")
      | 
lutrija.cpp:5: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    5 | #pragma GCC optimization ("unroll-loops")
      | 
lutrija.cpp: In function 'int main()':
lutrija.cpp:36:15: warning: unused variable 'i' [-Wunused-variable]
   36 |     ll T = 1, i, j;
      |               ^
lutrija.cpp:36:18: warning: unused variable 'j' [-Wunused-variable]
   36 |     ll T = 1, i, j;
      |                  ^
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 1 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 308 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -