Submission #19657405


Source Code Expand

Copy
#include <bits/stdc++.h>
#include <atcoder/all>
#define ll long long int
#define ld long double
#define yorn(f) std::cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) std::cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repi(i, n) for (ll i = 1; i < (ll)(n); i++)
#define foreach(i, v) for (auto& i : v)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define put(x) std::cout << x << endl;
#define println(x) std::cout << x << endl;
#define elif else if
#define pb push_back
#define eb emplace_back
#define sz(x) (int)x.size()
#define rrep(i, n) for (ll i = (ll)n-1; i >= 0; i--)
template<typename T>bool mins(T& x,const T&y){if(x>y){x=y;return true;}else return false;}
template<typename T>bool maxs(T& x,const T&y){if(x<y){x=y;return true;}else return false;}
const ll INF = 1e18;
const ll mod = 7+1e9;
using namespace std;
using namespace atcoder;
using BIT=fenwick_tree<ll>;
using UnionFind=dsu;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
typedef pair<ll, ll> P2;
typedef pair<ll, pair<ll, ll> > P3;
typedef tuple<ll, ll, ll> i3;

void Main()
{
    ll x, y;
    cin >> x >> y;

    if (x % y == 0) {
        put(-1);
        return;
    }

    repi(i, 1e18) {
        if (x * i % y != 0) {
            put(x * i);
            return;
        }
    }

}
signed main(){ Main();return 0;}

Submission Info

Submission Time
Task A - Two Integers
User GENNAI_AO
Language C++ (GCC 9.2.1)
Score 100
Code Size 1425 Byte
Status AC
Exec Time 8 ms
Memory 3636 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 14
Set Name Test Cases
Sample 0_000.txt, 0_001.txt
All 0_000.txt, 0_001.txt, 1_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt
Case Name Status Exec Time Memory
0_000.txt AC 8 ms 3456 KB
0_001.txt AC 2 ms 3636 KB
1_002.txt AC 2 ms 3632 KB
1_003.txt AC 3 ms 3468 KB
1_004.txt AC 2 ms 3456 KB
1_005.txt AC 2 ms 3528 KB
1_006.txt AC 2 ms 3636 KB
1_007.txt AC 2 ms 3632 KB
1_008.txt AC 2 ms 3632 KB
1_009.txt AC 2 ms 3528 KB
1_010.txt AC 2 ms 3528 KB
1_011.txt AC 3 ms 3472 KB
1_012.txt AC 2 ms 3592 KB
1_013.txt AC 2 ms 3504 KB
for_sample.txt AC 2 ms 3528 KB