結果
問題 |
No.7 プライムナンバーゲーム
|
ユーザー |
![]() |
提出日時 | 2017-09-24 16:11:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,359 bytes |
コンパイル時間 | 883 ms |
コンパイル使用メモリ | 87,320 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-14 07:11:18 |
合計ジャッジ時間 | 1,826 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 9 WA * 8 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:41:9: warning: use of an operand of type 'bool' in 'operator++' is deprecated [-Wdeprecated] 41 | wl[v]++; | ~~~~^
ソースコード
#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}); } } }