Submission #2225821
Source Code Expand
#include <iostream> #include <vector> #include <string> #include <algorithm> #define rep(i,n) for(int (i)=0;(i)<(n);(i)++) #define rep1(i,n) for(int i=1;i<=(int)(n);i++) using namespace std; typedef long long int lli; string R, T; int main() { cin >> R >> T; //Tの方が長かったら無条件で詰み int lr = (int)R.length(); int lt = (int)T.length(); if (lr<lt) cout << "UNRESTORABLE"; else { //Tが適合するか下から検索 bool match = false; for (int i = lr - lt;i >= 0;i--) { bool ptmatch = true; rep(j, lt)if (T[j] != R[i + j] && R[i + j] != '?')ptmatch = false; if (ptmatch) { match = true; rep(j, lt)R[i + j] = T[j]; rep(j, lr) { if (R[j] == '?') R[j] = 'a'; cout << R[j]; } break; } } if (!match)cout << "UNRESTORABLE"; } }
Submission Info
Submission Time | |
---|---|
Task | C - Dubious Document 2 |
User | spawn |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 845 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 |