Submission #1722356
Source Code Expand
#include<bits/stdc++.h> #define rep(i,a,b) for(int i=a;i<b;i++) #define rrep(i,a,b) for(int i=a;i>=b;i--) #define fore(i,a) for(auto &i:a) #pragma GCC optimize ("-O3") using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } //--------------------------------------------------------------------------------------------------- /*--------------------------------------------------------------------------------------------------- ∧_∧ ∧_∧ (´<_` ) Welcome to My Coding Space! ( ´_ゝ`) / ⌒i / \ | | / / ̄ ̄ ̄ ̄/ | __(__ニつ/ _/ .| .|____ \/____/ (u ⊃ ---------------------------------------------------------------------------------------------------*/ string SS, T; //--------------------------------------------------------------------------------------------------- string solve() { int N = SS.length(); int M = T.length(); set<string> ans; rrep(R, N, M) { int L = R - M; int ok = 1; rep(i, 0, M) if (SS[L + i] != '?' and SS[L + i] != T[i]) ok = 0; if (ok) { string S; rep(i, 0, N) S += SS[i]; rep(i, 0, M) S[L + i] = T[i]; rep(i, 0, N) if (S[i] == '?') S[i] = 'a'; ans.insert(S); } } if(ans.size() == 0) return "UNRESTORABLE"; return *(ans.begin()); } //--------------------------------------------------------------------------------------------------- void _main() { cin >> SS >> T; cout << solve() << endl; }
Submission Info
Submission Time | |
---|---|
Task | C - Dubious Document 2 |
User | hamayanhamayan |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1778 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 |