提出 #29444364
ソースコード 拡げる
// #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;
}
void solve() {
int a, b, c, d;
cin >> a >> b >> c >> d;
int MAX = 100005;
vector<int> isprime(MAX, true);
isprime[0] = isprime[1] = false;
for (int i = 2; i < MAX; i++) {
if (isprime[i]) {
for (int j = i+i; j < MAX; j+=i) {
isprime[j] = false;
}
}
}
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;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | D - Prime Sum Game |
| ユーザ | goropikari |
| 言語 | C++ (GCC 9.2.1) |
| 得点 | 400 |
| コード長 | 1666 Byte |
| 結果 | AC |
| 実行時間 | 8 ms |
| メモリ | 3784 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 400 / 400 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| 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 |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| hand_01.txt | AC | 8 ms | 3632 KiB |
| hand_02.txt | AC | 2 ms | 3692 KiB |
| hand_03.txt | AC | 3 ms | 3784 KiB |
| random_01.txt | AC | 3 ms | 3692 KiB |
| random_02.txt | AC | 3 ms | 3760 KiB |
| random_03.txt | AC | 4 ms | 3488 KiB |
| random_04.txt | AC | 2 ms | 3756 KiB |
| random_05.txt | AC | 3 ms | 3492 KiB |
| random_06.txt | AC | 2 ms | 3716 KiB |
| random_07.txt | AC | 3 ms | 3424 KiB |
| random_08.txt | AC | 3 ms | 3776 KiB |
| random_09.txt | AC | 2 ms | 3532 KiB |
| random_10.txt | AC | 4 ms | 3432 KiB |
| random_11.txt | AC | 2 ms | 3708 KiB |
| random_12.txt | AC | 3 ms | 3532 KiB |
| random_13.txt | AC | 4 ms | 3784 KiB |
| random_14.txt | AC | 3 ms | 3472 KiB |
| random_15.txt | AC | 6 ms | 3704 KiB |
| random_16.txt | AC | 2 ms | 3428 KiB |
| random_17.txt | AC | 2 ms | 3632 KiB |
| random_18.txt | AC | 4 ms | 3428 KiB |
| random_19.txt | AC | 3 ms | 3756 KiB |
| random_20.txt | AC | 2 ms | 3784 KiB |
| random_21.txt | AC | 2 ms | 3496 KiB |
| random_22.txt | AC | 2 ms | 3708 KiB |
| random_23.txt | AC | 3 ms | 3692 KiB |
| random_24.txt | AC | 2 ms | 3720 KiB |
| random_25.txt | AC | 2 ms | 3716 KiB |
| random_26.txt | AC | 2 ms | 3528 KiB |
| random_27.txt | AC | 3 ms | 3784 KiB |
| sample_01.txt | AC | 3 ms | 3716 KiB |
| sample_02.txt | AC | 3 ms | 3708 KiB |
| sample_03.txt | AC | 3 ms | 3716 KiB |