結果
問題 | No.2226 Hello, Forgotten World! |
ユーザー | sakasu1 |
提出日時 | 2023-03-26 21:39:30 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 763 bytes |
コンパイル時間 | 2,969 ms |
コンパイル使用メモリ | 211,916 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-10-19 13:53:16 |
合計ジャッジ時間 | 3,621 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | AC | 14 ms
4,348 KB |
testcase_02 | AC | 4 ms
4,348 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,348 KB |
testcase_07 | AC | 3 ms
4,348 KB |
testcase_08 | AC | 2 ms
4,348 KB |
testcase_09 | AC | 4 ms
4,348 KB |
ソースコード
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> P; int main(){ int i,j,t; cin >> t; while(t--){ vector<string> ans; int n; string s,t="helloworld",s1; cin >> n >> s; s1=s; for(i=n-10;i>=0;i--){ bool flag=true; for(j=i;j<i+10;j++){ if(!(s[j]==t[j-i] || s[j]=='?')) flag=false; } if(flag==false) continue; for(j=i;j<i+10;j++){ if(s[j]=='?') s[j]=t[j-i]; } for(j=0;j<i;j++){ if(s[j]=='?') s[j]='a'; } for(j=i+10;j<n;j++){ if(s[j]=='?') s[j]='a'; } ans.push_back(s); s=s1; } sort(ans.begin(),ans.end()); if(ans.size()==0) cout << -1 << endl; else cout << ans[0] << endl; } }