結果

問題 No.7 プライムナンバーゲーム
ユーザー ojisan_ITojisan_IT
提出日時 2017-09-24 16:11:07
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,359 bytes
コンパイル時間 1,046 ms
コンパイル使用メモリ 85,428 KB
実行使用メモリ 4,512 KB
最終ジャッジ日時 2023-08-09 01:58:30
合計ジャッジ時間 2,200 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 22 ms
4,380 KB
testcase_03 AC 6 ms
4,380 KB
testcase_04 WA -
testcase_05 AC 4 ms
4,384 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 15 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 22 ms
4,380 KB
testcase_15 AC 21 ms
4,384 KB
testcase_16 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:41:9: 警告: use of an operand of type ‘bool’ in ‘operator++’ is deprecated [-Wdeprecated]
   41 |     wl[v]++;
      |     ~~~~^

ソースコード

diff #

#include<iostream>
#include<vector>
#include<cmath>
#include<climits>
#include<algorithm>
#include<queue>
#include<tuple>

using namespace std;  
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define rep(i,n) for(ll i=0;i<(n);i++)  
#define pii pair<int,int>
#define piii pair<int,pii>
#define mp make_pair
#define pb push_back  
#define ALL(a) (a).begin(),(a).end()
#define FST first
#define SEC second  
const int INF = (INT_MAX/2);
const ll LLINF = (LLONG_MAX/2);
const double eps = 1e-5;
const double PI = M_PI;  
#define DEB cerr<<"!"<<endl
#define SHOW(a,b) cerr<<(a)<<" "<<(b)<<endl
#define SHOWARRAY(ar,i,j) REP(a,i)REP(b,j)cerr<<ar[a][b]<<((b==j-1)?((a==i-1)?("\n\n"):("\n")):(" "))

typedef tuple<int,int> tii;
bool wl[10001];
int main(){
  int n; cin >> n;
  vi t ={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};
  auto c = [](const tii a,const tii b){return get<0>(a) > get<0>(b);};
  priority_queue<tii,vector<tii>,decltype(c)> q(c);
  q.push(tii{0,0});
  q.push(tii{1,0});
  while(1){
    int v = get<0>(q.top());int turn = get<1>(q.top()); q.pop();
    if(v >= 10001 || wl[v] != 0) continue;
    wl[v]++;
    if(v == n)
      if(turn%2){cout << "Lose" << endl;return 0;}
      else{cout << "Win"<<endl;return 0;}
    else
      rep(i,t.size()){
        q.push(tii{v+t[i],turn+1});
      }
  }
}
0