結果

問題 No.7 プライムナンバーゲーム
ユーザー ojisan_ITojisan_IT
提出日時 2017-09-24 16:03:28
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,261 bytes
コンパイル時間 845 ms
コンパイル使用メモリ 87,360 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-26 17:34:05
合計ジャッジ時間 1,753 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
6,812 KB
testcase_01 AC 13 ms
6,944 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 13 ms
6,940 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 9 ms
6,940 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 9 ms
6,944 KB
testcase_12 AC 4 ms
6,940 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:40:9: warning: use of an operand of type 'bool' in 'operator++' is deprecated [-Wdeprecated]
   40 |     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};
  priority_queue<tii> q;
  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