Submission #953605
Source Code Expand
#include <bits/stdc++.h> using namespace std; #define rep(i,x,y) for(int i=(x);i<(y);++i) #define debug(x) #x << "=" << (x) #ifdef DEBUG #define _GLIBCXX_DEBUG #define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl #else #define print(x) #endif const int inf=1e9; const int64_t inf64=1e18; const double eps=1e-9; template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (const auto &v : vec) { os << v << ","; } os << "]"; return os; } void solve(){ int n; string s,t; cin >> n >> s >> t; rep(i,0,n+1){ string u=s.substr(0,i)+t; bool ok=true; rep(j,0,n){ if(s[j]!=u[j]){ ok=false; break; } } if(!ok) continue; rep(j,0,n){ if(t[n-j-1]!=u[u.size()-j-1]){ ok=false; break; } } cout << u.size() << endl; return; } } int main(){ std::cin.tie(0); std::ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(10); solve(); return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Prefix and Suffix |
User | walkre |
Language | C++14 (GCC 5.4.1) |
Score | 200 |
Code Size | 1219 Byte |
Status | AC |
Exec Time | 3 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 3 ms | 256 KB |
0_01.txt | AC | 3 ms | 256 KB |
0_02.txt | AC | 3 ms | 256 KB |
1_00.txt | AC | 3 ms | 256 KB |
1_01.txt | AC | 3 ms | 256 KB |
1_02.txt | AC | 3 ms | 256 KB |
1_03.txt | AC | 3 ms | 256 KB |
1_04.txt | AC | 3 ms | 256 KB |
1_05.txt | AC | 3 ms | 256 KB |