Submission #29478743


Source Code Expand

// #include <atcoder/all>
// using namespace atcoder;
// using mint = modint998244353;
// using mint = modint1000000007;
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define rep2(i,k,n) for (int i = (k); i < (n); ++i)
using namespace std;
using ll = long long;
// using P = pair<ll,ll>;
using P = pair<int,int>;
using vint = vector<int>;
using vll = vector<ll>;
using vvint = vector<vector<int>>;
using vvll = vector<vector<ll>>;

// const ll INF = (ll)2e18+9;
const int INF = (int)2e9+7;
// const ll MOD = (ll)1e9+9;
template<typename T>
void chmin(T &a, T b) { a = min(a, b); }
template<typename T>
void chmax(T &a, T b) { a = max(a, b); }

template<typename T>
void print(vector<T> v) {
    int n = v.size();
    rep(i,n) {
        if (i == 0) cout << v[i];
        else cout << ' ' << v[i];
    }
    cout << endl;
}

bool isprime(int x) {
    if (x < 2) return false;
    for (int i = 2; i*i <= x; i++) {
        if (x % i == 0) return false;
    }
    return true;
}

void solve() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    for (int taka = a; taka <= b; taka++) {
        int ok = 1;
        for (int aoki = c; aoki <= d; aoki++) {
            if (isprime(taka+aoki)) ok = 0;
        }
        if (ok) {
            cout << "Takahashi" << endl;
            return;
        }
    }
    cout << "Aoki" << endl;
}

int main() {
    solve();
    return 0;
}

Submission Info

Submission Time
Task D - Prime Sum Game
User goropikari
Language C++ (GCC 9.2.1)
Score 400
Code Size 1544 Byte
Status AC
Exec Time 8 ms
Memory 3596 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 33
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All hand_01.txt, hand_02.txt, hand_03.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
hand_01.txt AC 8 ms 3596 KiB
hand_02.txt AC 2 ms 3560 KiB
hand_03.txt AC 2 ms 3364 KiB
random_01.txt AC 2 ms 3568 KiB
random_02.txt AC 2 ms 3548 KiB
random_03.txt AC 2 ms 3524 KiB
random_04.txt AC 2 ms 3500 KiB
random_05.txt AC 2 ms 3524 KiB
random_06.txt AC 2 ms 3592 KiB
random_07.txt AC 2 ms 3424 KiB
random_08.txt AC 3 ms 3568 KiB
random_09.txt AC 2 ms 3524 KiB
random_10.txt AC 2 ms 3404 KiB
random_11.txt AC 2 ms 3560 KiB
random_12.txt AC 2 ms 3408 KiB
random_13.txt AC 2 ms 3568 KiB
random_14.txt AC 2 ms 3412 KiB
random_15.txt AC 2 ms 3492 KiB
random_16.txt AC 2 ms 3596 KiB
random_17.txt AC 1 ms 3520 KiB
random_18.txt AC 3 ms 3560 KiB
random_19.txt AC 2 ms 3560 KiB
random_20.txt AC 1 ms 3592 KiB
random_21.txt AC 3 ms 3560 KiB
random_22.txt AC 2 ms 3376 KiB
random_23.txt AC 3 ms 3576 KiB
random_24.txt AC 2 ms 3544 KiB
random_25.txt AC 3 ms 3424 KiB
random_26.txt AC 2 ms 3544 KiB
random_27.txt AC 2 ms 3368 KiB
sample_01.txt AC 1 ms 3364 KiB
sample_02.txt AC 2 ms 3404 KiB
sample_03.txt AC 2 ms 3548 KiB