結果
問題 | No.2226 Hello, Forgotten World! |
ユーザー |
|
提出日時 | 2023-04-29 16:38:30 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 2,958 bytes |
コンパイル時間 | 4,086 ms |
コンパイル使用メモリ | 238,052 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-18 11:42:32 |
合計ジャッジ時間 | 4,634 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 9 |
ソースコード
#include <iostream>#include <bits/stdc++.h>#include <atcoder/all>using namespace std;using namespace atcoder;typedef long long ll;typedef long double dd;typedef unsigned long long ull;typedef vector<ll> vl;typedef vector<dd> vd;typedef vector<bool> vb;typedef vector<string> vs;typedef vector<pair<ll,ll>> vl_l;typedef vector<vector<ll>> vvl;typedef vector<vector<dd>> vvd;typedef vector<vector<bool>> vvb;typedef vector<vector<string>> vvs;typedef vector<vector<pair<ll,ll>>> vvl_l;typedef vector<vector<vector<ll>>> vvvl;typedef vector<vector<vector<dd>>> vvvd;typedef vector<vector<vector<bool>>> vvvb;typedef vector<vector<vector<string>>> vvvs;typedef vector<vector<vector<pair<ll,ll>>>> vvvl_l;typedef map<ll,ll> ml;typedef set<ll> sl;// #define i_7 (ll)(1E9+7)#define i_7 998244353#define i_5 i_7-2ll mod(ll a){ll c=a%i_7;if(c>=0)return c;return c+i_7;}typedef pair<ll,ll> l_l;typedef pair<dd,dd> d_d;ll inf=(ll)1E18;#define rep(i,l,r) for(ll i=l;i<=r;i++)#define pb push_backll max(ll a,ll b){if(a<b)return b;else return a;}ll min(ll a,ll b){if(a>b)return b;else return a;}dd EPS=1E-9;dd PI=acos(-1);// #define endl "\n"#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);template<class T,class S>inline bool chmax(T &a, S b) {if(a < b) {a = (T)b;return true;}return false;}template<class T,class S>inline bool chmin(T &a, S b) {if(a > b) {a = (T)b;return true;}return false;}ll hpow(ll x,ll y){if(y==0)return 1;ll res=hpow(x,y/2);res = mod(res*res);if(y%2==1){res *= x;res = mod(res);}return mod(res);}ll hpow_m(ll x,ll y,ll m){if(y==0)return 1;ll res=hpow_m(x,y/2,m);res = (res*res)%m;if(y%2==1){res *= x;res %= m;}return res%m;}void solve(){ll n;cin>>n;string s;cin>>s;string t = "helloworld";vector<string> anss;for(ll i = (ll)s.size() - 1; i >= 0; i--){bool ok = true;rep(j,0,t.size()-1){ll k = i + j;if(k >= (ll)s.size()){ok = false;break;}if(s[k] == t[j] || s[k] == '?'){ok = true;}else{ok = false;break;}}if(!ok)continue;string ans = s;rep(j,0,t.size()-1){ll k = i + j;ans[k] = t[j];}rep(j,0,s.size()-1){if(ans[j] == '?'){ans[j] = 'a';}}anss.pb(ans);}if((ll)anss.size() == 0){cout << -1 << endl;}else{sort(anss.begin(), anss.end());cout << anss[0] << endl;}}signed main(){fastioll t;cin>>t;rep(i,0,t-1){solve();}return 0;}