Submission #29475563


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
bool is_prime(int x){
  vector<int> prime = {2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,
          89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,
          191,193,197,199, 211};
  for (int p: prime){
    if (p == x){
      return true;
    }
  }
  return false;
}

bool is_there_prime(int x, int r){
  for (int i=x;i<x+r;i++){
    if (is_prime(i)){
      return true;
    }
  }
  return false;
}

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  vector<int> prime;
  int r = D - C + 1;
  
  string winner = "Aoki";
  for (int i=A+C; i<=B+C; ++i){
    if (! is_there_prime(i, r)){
      winner = "Takahashi";
      break;
    }
  }
  cout << winner << endl;
  return 0;
}

Submission Info

Submission Time
Task D - Prime Sum Game
User nullpoint
Language C++ (GCC 9.2.1)
Score 400
Code Size 818 Byte
Status AC
Exec Time 2 ms
Memory 3604 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 1 ms 3444 KiB
hand_02.txt AC 2 ms 3444 KiB
hand_03.txt AC 2 ms 3604 KiB
random_01.txt AC 1 ms 3520 KiB
random_02.txt AC 2 ms 3468 KiB
random_03.txt AC 2 ms 3572 KiB
random_04.txt AC 2 ms 3524 KiB
random_05.txt AC 1 ms 3528 KiB
random_06.txt AC 2 ms 3572 KiB
random_07.txt AC 2 ms 3440 KiB
random_08.txt AC 2 ms 3388 KiB
random_09.txt AC 2 ms 3392 KiB
random_10.txt AC 2 ms 3456 KiB
random_11.txt AC 2 ms 3396 KiB
random_12.txt AC 2 ms 3604 KiB
random_13.txt AC 2 ms 3468 KiB
random_14.txt AC 2 ms 3508 KiB
random_15.txt AC 2 ms 3464 KiB
random_16.txt AC 2 ms 3472 KiB
random_17.txt AC 2 ms 3392 KiB
random_18.txt AC 2 ms 3580 KiB
random_19.txt AC 2 ms 3408 KiB
random_20.txt AC 2 ms 3388 KiB
random_21.txt AC 2 ms 3576 KiB
random_22.txt AC 2 ms 3524 KiB
random_23.txt AC 2 ms 3568 KiB
random_24.txt AC 2 ms 3572 KiB
random_25.txt AC 2 ms 3580 KiB
random_26.txt AC 2 ms 3508 KiB
random_27.txt AC 2 ms 3600 KiB
sample_01.txt AC 2 ms 3392 KiB
sample_02.txt AC 2 ms 3460 KiB
sample_03.txt AC 2 ms 3500 KiB