Submission #2531985
Source Code Expand
#include<algorithm> #include<iostream> #include<cstdio> #include<map> #include<set> using namespace std; string s,t; set<string> S; void Work() { int lens=s.size(); int lent=t.size(); for(int i=0;i<lens;i++) { if(s[i]=='?'||s[i]==t[0]) { string tmp=s; for(int j=0;j<i;j++) if(tmp[j]=='?') tmp[j]='a'; bool can=false; for(int j=0;j<lent;j++) { if(tmp[i+j]!='?'&&tmp[i+j]!=t[j]) break; tmp[i+j]=t[j]; if(j == lent - 1) can = true; } if(can) { for(int j = i + lent; j < lens; j++) if(tmp[j] == '?') tmp[j] = 'a'; S.insert(tmp); } } } if(S.size()==0) cout<<"UNRESTORABLE"<<endl; else cout<<*S.begin()<<endl; } int main() { cin>>s>>t; Work(); }
Submission Info
Submission Time | |
---|---|
Task | C - Dubious Document 2 |
User | vjudge4 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 946 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | s1.txt, s2.txt |
All | in01.txt, in02.txt, in03.txt, in04.txt, in05.txt, in06.txt, in07.txt, in08.txt, in09.txt, in10.txt, in11.txt, in12.txt, s1.txt, s2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in01.txt | AC | 1 ms | 256 KB |
in02.txt | AC | 1 ms | 256 KB |
in03.txt | AC | 1 ms | 256 KB |
in04.txt | AC | 1 ms | 256 KB |
in05.txt | AC | 1 ms | 256 KB |
in06.txt | AC | 1 ms | 256 KB |
in07.txt | AC | 1 ms | 256 KB |
in08.txt | AC | 1 ms | 256 KB |
in09.txt | AC | 1 ms | 256 KB |
in10.txt | AC | 1 ms | 256 KB |
in11.txt | AC | 1 ms | 256 KB |
in12.txt | AC | 1 ms | 256 KB |
s1.txt | AC | 1 ms | 256 KB |
s2.txt | AC | 1 ms | 256 KB |