Submission #65253618


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
int main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  string n;
  cin >> n;
  int cnt = 0;
  for (int i = 0; i < s.size() - n.size() + 1; i++)
  {
    cnt = 0;
    for (int j = 0; j < n.size(); j++)
    {
      if (s[i + j] == n[j] || s[i + j] == '?')
      {
        cnt++;
      }
      if (cnt == n.size())
      {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
}

Submission Info

Submission Time
Task B - Four Hidden
User k10k10
Language C++ 20 (gcc 12.2)
Score 250
Code Size 512 Byte
Status AC
Exec Time 1 ms
Memory 3620 KiB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:12:21: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   12 |   for (int i = 0; i < s.size() - n.size() + 1; i++)
      |                   ~~^~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:15:23: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   15 |     for (int j = 0; j < n.size(); j++)
      |                     ~~^~~~~~~~~~
Main.cpp:21:15: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   21 |       if (cnt == n.size())
      |           ~~~~^~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 250 / 250
Status
AC × 3
AC × 25
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.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, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 02_handmade_01.txt, 02_handmade_02.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 1 ms 3492 KiB
00_sample_02.txt AC 1 ms 3476 KiB
00_sample_03.txt AC 1 ms 3368 KiB
01_random_01.txt AC 1 ms 3488 KiB
01_random_02.txt AC 1 ms 3400 KiB
01_random_03.txt AC 1 ms 3620 KiB
01_random_04.txt AC 1 ms 3552 KiB
01_random_05.txt AC 1 ms 3404 KiB
01_random_06.txt AC 1 ms 3492 KiB
01_random_07.txt AC 1 ms 3472 KiB
01_random_08.txt AC 1 ms 3564 KiB
01_random_09.txt AC 1 ms 3428 KiB
01_random_10.txt AC 1 ms 3488 KiB
01_random_11.txt AC 1 ms 3480 KiB
01_random_12.txt AC 1 ms 3484 KiB
01_random_13.txt AC 1 ms 3572 KiB
01_random_14.txt AC 1 ms 3360 KiB
01_random_15.txt AC 1 ms 3488 KiB
01_random_16.txt AC 1 ms 3420 KiB
01_random_17.txt AC 1 ms 3500 KiB
01_random_18.txt AC 1 ms 3432 KiB
01_random_19.txt AC 1 ms 3432 KiB
01_random_20.txt AC 1 ms 3480 KiB
02_handmade_01.txt AC 1 ms 3396 KiB
02_handmade_02.txt AC 1 ms 3340 KiB