Submission #74680978


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	string s,t;
	cin>>s>>t;
	long long ans=0;
	for(int i=0;i<s.size();i++){
		int k=0;
		int j;
		for(j=i;j<s.size();j++){
			if(k<t.size()&&s[j]==t[k])k++;
			if(k==t.size())break;
		}
		ans+=j-i;
	}
	cout<<ans<<'\n';
}

Submission Info

Submission Time
Task D - No-Subsequence Substring
User ywrow
Language C++23 (GCC 15.2.0)
Score 400
Code Size 331 Byte
Status AC
Exec Time 122 ms
Memory 3900 KiB

Compile Error

./Main.cpp: In function 'int main()':
./Main.cpp:9:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |         for(int i=0;i<s.size();i++){
      |                     ~^~~~~~~~~
./Main.cpp:12:26: 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(j=i;j<s.size();j++){
      |                         ~^~~~~~~~~
./Main.cpp:13:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 |                         if(k<t.size()&&s[j]==t[k])k++;
      |                            ~^~~~~~~~~
./Main.cpp:14:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |                         if(k==t.size())break;
      |                            ~^~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 56
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_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, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 01_random_25.txt, 01_random_26.txt, 01_random_27.txt, 01_random_28.txt, 01_random_29.txt, 01_random_30.txt, 01_random_31.txt, 01_random_32.txt, 01_random_33.txt, 01_random_34.txt, 01_random_35.txt, 01_random_36.txt, 01_random_37.txt, 01_random_38.txt, 01_random_39.txt, 01_random_40.txt, 01_random_41.txt, 01_random_42.txt, 01_random_43.txt, 01_random_44.txt, 01_random_45.txt, 01_random_46.txt, 01_random_47.txt, 01_random_48.txt, 01_random_49.txt, 01_random_50.txt, 01_random_51.txt, 01_random_52.txt, 01_random_53.txt, 01_random_54.txt, 01_random_55.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3652 KiB
00_sample_01.txt AC 1 ms 3612 KiB
00_sample_02.txt AC 1 ms 3500 KiB
01_random_03.txt AC 49 ms 3744 KiB
01_random_04.txt AC 73 ms 3756 KiB
01_random_05.txt AC 25 ms 3868 KiB
01_random_06.txt AC 39 ms 3760 KiB
01_random_07.txt AC 30 ms 3808 KiB
01_random_08.txt AC 57 ms 3800 KiB
01_random_09.txt AC 92 ms 3900 KiB
01_random_10.txt AC 68 ms 3892 KiB
01_random_11.txt AC 117 ms 3860 KiB
01_random_12.txt AC 21 ms 3732 KiB
01_random_13.txt AC 24 ms 3840 KiB
01_random_14.txt AC 78 ms 3856 KiB
01_random_15.txt AC 91 ms 3872 KiB
01_random_16.txt AC 112 ms 3808 KiB
01_random_17.txt AC 74 ms 3880 KiB
01_random_18.txt AC 24 ms 3852 KiB
01_random_19.txt AC 122 ms 3852 KiB
01_random_20.txt AC 73 ms 3876 KiB
01_random_21.txt AC 28 ms 3704 KiB
01_random_22.txt AC 113 ms 3748 KiB
01_random_23.txt AC 120 ms 3804 KiB
01_random_24.txt AC 43 ms 3744 KiB
01_random_25.txt AC 61 ms 3852 KiB
01_random_26.txt AC 36 ms 3848 KiB
01_random_27.txt AC 40 ms 3804 KiB
01_random_28.txt AC 55 ms 3672 KiB
01_random_29.txt AC 38 ms 3844 KiB
01_random_30.txt AC 32 ms 3876 KiB
01_random_31.txt AC 32 ms 3752 KiB
01_random_32.txt AC 3 ms 3744 KiB
01_random_33.txt AC 38 ms 3844 KiB
01_random_34.txt AC 32 ms 3900 KiB
01_random_35.txt AC 45 ms 3740 KiB
01_random_36.txt AC 39 ms 3856 KiB
01_random_37.txt AC 27 ms 3840 KiB
01_random_38.txt AC 28 ms 3732 KiB
01_random_39.txt AC 29 ms 3860 KiB
01_random_40.txt AC 4 ms 3860 KiB
01_random_41.txt AC 7 ms 3856 KiB
01_random_42.txt AC 6 ms 3744 KiB
01_random_43.txt AC 2 ms 3740 KiB
01_random_44.txt AC 5 ms 3804 KiB
01_random_45.txt AC 2 ms 3740 KiB
01_random_46.txt AC 7 ms 3836 KiB
01_random_47.txt AC 5 ms 3860 KiB
01_random_48.txt AC 1 ms 3680 KiB
01_random_49.txt AC 5 ms 3844 KiB
01_random_50.txt AC 3 ms 3752 KiB
01_random_51.txt AC 8 ms 3848 KiB
01_random_52.txt AC 2 ms 3692 KiB
01_random_53.txt AC 1 ms 3612 KiB
01_random_54.txt AC 1 ms 3560 KiB
01_random_55.txt AC 1 ms 3596 KiB