結果
問題 | No.2226 Hello, Forgotten World! |
ユーザー | cho435 |
提出日時 | 2023-02-25 17:40:50 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 828 bytes |
コンパイル時間 | 2,325 ms |
コンパイル使用メモリ | 209,424 KB |
実行使用メモリ | 4,356 KB |
最終ジャッジ日時 | 2023-10-11 14:57:19 |
合計ジャッジ時間 | 3,071 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,352 KB |
testcase_01 | AC | 14 ms
4,352 KB |
testcase_02 | AC | 4 ms
4,352 KB |
testcase_03 | AC | 4 ms
4,348 KB |
testcase_04 | AC | 2 ms
4,348 KB |
testcase_05 | AC | 5 ms
4,348 KB |
testcase_06 | AC | 3 ms
4,352 KB |
testcase_07 | AC | 3 ms
4,348 KB |
testcase_08 | AC | 2 ms
4,356 KB |
testcase_09 | AC | 3 ms
4,348 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i,n) for(int i=0;i<int(n);i++) const int MOD = 998244353; int main(){ string he="helloworld"; int t; cin>>t; rep(Ti,t){ int n; cin>>n; string s; cin>>s; vector<string> ans; for(int i=n-he.size();i>=0;i--){ int flg=0; for(int j=0;j<he.size();j++){ if(s.at(i+j)=='?') continue; if(s.at(i+j)!=he.at(j)){ flg=1; break; } } if(flg) continue; string ls=s; for(int j=0;j<he.size();j++){ ls.at(i+j)=he.at(j); } for(int j=0;j<n;j++){ if(ls.at(j)=='?') ls.at(j)='a'; } ans.push_back(ls); } sort(ans.begin(),ans.end()); if(ans.size()==0) cout<<"-1"<<endl; else cout<<ans.at(0)<<endl; } }