結果
問題 | No.726 Tree Game |
ユーザー |
![]() |
提出日時 | 2020-04-02 00:34:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,942 bytes |
コンパイル時間 | 2,072 ms |
コンパイル使用メモリ | 193,736 KB |
最終ジャッジ日時 | 2025-01-09 12:29:05 |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 24 WA * 1 |
ソースコード
#include<bits/stdc++.h>using lint=long long;using real=long double;void debug_impl(){std::cerr<<'\n';}template<class Head,class...Tail>void debug_impl(Head head, Tail... tail){std::cerr << " " << head;debug_impl(tail...);}template<class Container,class Value=typename Container::value_type,std::enable_if_t<!std::is_same<Container,std::string>::value,std::nullptr_t> =nullptr>std::ostream&operator<<(std::ostream&os,Container const&v){os<<"{";for(auto it=v.begin();it!=v.end();it++){os<<(it!=v.begin()?",":"")<<*it;}return os<<"}";}template<template<class...>class Tuple,class...Args,std::size_t...Inds,std::size_t=std::tuple_size<Tuple<Args...>>::value>std::ostream&tuple_output_impl(std::ostream&os,const Tuple<Args...>&tuple,std::integer_sequence<std::size_t,Inds...>){os<<"(";(void)std::initializer_list<int>{((void)(os<<(Inds>0?",":"")<<std::get<Inds>(tuple)),0)...};return os<<")";}template<template<class...>class Tuple,class...Args,std::size_t=std::tuple_size<Tuple<Args...>>::value>std::ostream&operator<<(std::ostream&os,const Tuple<Args...>&tuple){return tuple_output_impl(os,tuple,std::index_sequence_for<Args...>());}#define DEBUG 1#if DEBUG#define debug(...)do{std::cerr<<std::boolalpha<<"["<<#__VA_ARGS__<<"]:";debug_impl(__VA_ARGS__);std::cerr<<std::noboolalpha;}while(false)#else#define debug(...) {}#endifint main(){std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);std::cout.setf(std::ios_base::fixed);std::cout.precision(15);auto is_prime=[&](lint x){if(x<2)return false;for(lint i=2;i*i<=x;i++)if(x%i==0)return false;return true;};lint x,y;std::cin>>x>>y;bool px=is_prime(x),py=is_prime(y);if(px&&py){std::cout<<"Second"<<'\n';return 0;}lint ans=px||py;x+=px,y+=py;for(;!is_prime(x);x++,ans++);for(;!is_prime(y);y++,ans++);std::cout<<(ans%2?"First":"Second")<<'\n';}