結果
問題 | No.252 "良問"(良問とは言っていない (2) |
ユーザー |
|
提出日時 | 2020-03-05 07:49:12 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 75 ms / 2,000 ms |
コード長 | 515 bytes |
コンパイル時間 | 484 ms |
コンパイル使用メモリ | 67,792 KB |
実行使用メモリ | 5,432 KB |
最終ジャッジ日時 | 2024-10-14 00:44:59 |
合計ジャッジ時間 | 1,274 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 |
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 7 | main() | ^~~~
ソースコード
#include<iostream> #include<algorithm> using namespace std; int T; string s; bool pf[1<<20]; main() { cin>>T; for(;T--;) { cin>>s; int ans=1e9,cummin=1e9,pc=0; for(int i=0;i+6<s.size();i++) { int cnt=0; for(int j=0;j<7;j++)cnt+=s[i+j]!="problem"[j]; ans=min(ans,cummin+cnt+pc); if(pf[i]=cnt==0)pc++; if(i>=3) { int now=0; for(int j=0;j<4;j++)now+=s[i-3+j]!="good"[j]; for(int j=i-9;j<=i;j++)if(j>=0&&pf[j])now--; cummin=min(cummin,now); } } cout<<ans<<endl; } }