結果
問題 | No.1313 N言っちゃダメゲーム (4) |
ユーザー | kotatsugame |
提出日時 | 2020-12-10 00:15:39 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 8 ms / 2,000 ms |
コード長 | 340 bytes |
コンパイル時間 | 532 ms |
コンパイル使用メモリ | 64,384 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 06:43:59 |
合計ジャッジ時間 | 1,854 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 35 |
コンパイルメッセージ
main.cpp:6:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 6 | main() | ^~~~
ソースコード
#include<iostream> using namespace std; int N,K; string s; int ok[2<<17]; main() { cin>>N>>K>>s; int cnt=0; for(int i=N-1;i>=0;i--) { if(i>0&&s[i-1]=='x')ok[i]=0; else { ok[i]=cnt>0?1:-1; if(ok[i]<0)cnt++; } if(i+K<N&&ok[i+K]<0)cnt--; } if(ok[0]<0)cout<<0<<endl; else for(int i=1;i<=K;i++)if(ok[i]<0)cout<<i<<endl; }