結果
| 問題 |
No.361 門松ゲーム2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-07-31 00:46:27 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 17 ms / 2,000 ms |
| コード長 | 478 bytes |
| コンパイル時間 | 2,097 ms |
| コンパイル使用メモリ | 195,532 KB |
| 最終ジャッジ日時 | 2025-01-12 08:23:41 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 28 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
8 | int n,d; scanf("%d%d",&n,&d);
| ~~~~~^~~~~~~~~~~~~~
ソースコード
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
int n,d; scanf("%d%d",&n,&d);
vector<int> grundy(n+1);
for(int l=1;l<=n;l++){
vector<bool> vis(n);
for(int i=1;i<l;i++){
for(int j=i+1;j<l;j++){
int k=l-i-j;
if(j>=k) break;
if(k-i<=d){
vis[grundy[i]^grundy[j]^grundy[k]]=true;
}
}
}
rep(x,n) if(!vis[x]) {
grundy[l]=x;
break;
}
}
puts(grundy[n]>0?"kado":"matsu");
return 0;
}