Submission #953587
Source Code Expand
#include <stdio.h> #include <cmath> #include <algorithm> #include <vector> #include <stack> #include <queue> #include <functional> #include <cstring> #include <string> #include <map> #include <set> #include <iostream> #include <ctime> #include <complex> #define enp printf("**Entry Point**\n") #define A first #define B second #define MP make_pair using namespace std; typedef long long ll; const int INF = 0x6fffffff; const int MINF = 0x80000000; const ll mod = 1000000007; const int cons = 100001; const double pi = 3.141592653589793; int main() { int n; string s; string t; cin >> n >> s >> t; if (s.length() + t.length() > n) { int ans = s.length() + t.length(); for (int i = 0; i < s.length(); i++) { int tmp = 0; bool flag = true; for (int j = 0; i + j < s.length() && j < t.length(); j++) { if (s[i + j] != t[j]) { flag = false; break; } } if (flag) { ans = s.length() + t.length() - (s.length() - i); } } printf("%d\n", ans); } else { printf("%d\n", n); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Prefix and Suffix |
User | softgoorm |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1136 Byte |
Status | WA |
Exec Time | 3 ms |
Memory | 384 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 3 ms | 256 KB |
1_02.txt | AC | 3 ms | 384 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 |