Submission #3386833


Source Code Expand

Copy
#include <iostream>
#include <vector>
using namespace std;

int main(){
  size_t N;
  string S, T;
  cin >> N >> S >> T;
  for(int i = 0; i < N; ++i){
    if(S.substr(i,N-i) == T.substr(0,N-i)){
      cout << S.length()+i << endl;
      return 0;
    }
  }
  cout << S.length()+T.length() << endl;
  return 0;
}

Submission Info

Submission Time
Task A - Prefix and Suffix
User TAB
Language C++14 (GCC 5.4.1)
Score 200
Code Size 329 Byte
Status
Exec Time 1 ms
Memory 256 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_00.txt, 0_01.txt, 0_02.txt
All 200 / 200 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 1 ms 256 KB
0_01.txt 1 ms 256 KB
0_02.txt 1 ms 256 KB
1_00.txt 1 ms 256 KB
1_01.txt 1 ms 256 KB
1_02.txt 1 ms 256 KB
1_03.txt 1 ms 256 KB
1_04.txt 1 ms 256 KB
1_05.txt 1 ms 256 KB