結果
| 問題 |
No.7 プライムナンバーゲーム
|
| コンテスト | |
| ユーザー |
ojisan_IT
|
| 提出日時 | 2017-09-24 16:03:28 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,261 bytes |
| コンパイル時間 | 885 ms |
| コンパイル使用メモリ | 88,412 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-14 07:10:13 |
| 合計ジャッジ時間 | 1,890 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 WA * 10 |
コンパイルメッセージ
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]++;
| ~~~~^
ソースコード
#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});
}
}
}
ojisan_IT