Submission #46082397


Source Code Expand

#include <iostream>
#include <string>

using namespace std;

int main(){
  int n, m;
  string s, t;
  cin >> n >> m >> s >> t;
  bool pref = false;
  bool suff = false;
  if (t.compare(0, n, s) == 0){
    pref = true;
  }
  if (t.compare(t.size() - n, n, s) == 0){
    suff = true;
  }
  if (pref && suff){
    cout << 0 << endl;
  }else if (pref && !suff){
    cout << 1 << endl;
  }else if (!pref && suff){
    cout << 2 << endl;
  }else {
    cout << 3 << endl;
  }
  return 0; 
}

Submission Info

Submission Time
Task B - Prefix and Suffix
User ThousandthStar
Language C++ 17 (gcc 12.2)
Score 200
Code Size 514 Byte
Status AC
Exec Time 1 ms
Memory 3676 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 24
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 02_corner_00.txt, 02_corner_01.txt, 02_corner_02.txt, 02_corner_03.txt, 03_hack_00.txt, 03_hack_01.txt, 03_hack_02.txt, 03_hack_03.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3468 KiB
00_sample_01.txt AC 1 ms 3556 KiB
00_sample_02.txt AC 1 ms 3520 KiB
00_sample_03.txt AC 1 ms 3528 KiB
01_random_00.txt AC 1 ms 3536 KiB
01_random_01.txt AC 1 ms 3616 KiB
01_random_02.txt AC 1 ms 3564 KiB
01_random_03.txt AC 1 ms 3564 KiB
01_random_04.txt AC 1 ms 3676 KiB
01_random_05.txt AC 1 ms 3528 KiB
01_random_06.txt AC 1 ms 3428 KiB
01_random_07.txt AC 1 ms 3524 KiB
01_random_08.txt AC 1 ms 3468 KiB
01_random_09.txt AC 1 ms 3564 KiB
01_random_10.txt AC 1 ms 3428 KiB
01_random_11.txt AC 1 ms 3440 KiB
02_corner_00.txt AC 1 ms 3556 KiB
02_corner_01.txt AC 1 ms 3432 KiB
02_corner_02.txt AC 1 ms 3556 KiB
02_corner_03.txt AC 1 ms 3464 KiB
03_hack_00.txt AC 1 ms 3524 KiB
03_hack_01.txt AC 1 ms 3672 KiB
03_hack_02.txt AC 1 ms 3528 KiB
03_hack_03.txt AC 1 ms 3480 KiB