提出 #577178


ソースコード 拡げる

#include <iostream>
#include <string>
using namespace std;

int main() {
	string S, T;
	bool flg = true;
	cin >> S >> T;

	for(int k = 0, i = 0, j = 0; k < S.size(); k++) {
		if(k%2) {
			while(j < T.size() && T[j] != S[k]) j++;
			if(j >= T.size())
				flg = false;
			j++;
		}
		else {
			while(i < S.size() && S[i] != S[k]) i++;
			if(i >= S.size())
				flg = false;
			i++;
		}
	}
	if(flg) {
		cout << "Yes" << endl;
		return 0;
	}

	flg = true;
	for(int k = 0, i = 0, j = 0; k < S.size(); k++) {
		if(!(k%2)) {
			while(j < T.size() && T[j] != S[k]) j++;
			if(j >= T.size())
				flg = false;
			j++;
		}
		else {
			while(i < S.size() && S[i] != S[k]) i++;
			if(i >= S.size())
				flg = false;
			i++;
		}
	}
	if(flg) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
}

提出情報

提出日時
問題 A - M and A
ユーザ qu1temp1
言語 C++11 (GCC 4.8.1)
得点 100
コード長 839 Byte
結果 AC
実行時間 28 ms
メモリ 928 KiB

ジャッジ結果

セット名 All
得点 / 配点 100 / 100
結果
AC × 47
セット名 テストケース
All 00_sample_00, 00_sample_01, 00_sample_02, 01_small_00, 01_small_01, 01_small_02, 01_small_03, 01_small_04, 01_small_05, 01_small_06, 01_small_07, 01_small_08, 01_small_09, 01_small_10, 01_small_11, 01_small_12, 01_small_13, 01_small_14, 01_small_15, 01_small_16, 01_small_17, 01_small_18, 01_small_19, 02_large_00, 02_large_01, 02_large_02, 02_large_03, 02_large_04, 02_large_05, 02_large_06, 02_large_07, 02_large_08, 02_large_09, 03_max_00, 03_max_01, 03_max_02, 03_max_03, 03_max_04, 03_max_05, 04_abab_00, 04_abab_01, 04_abab_02, 04_abab_03, 04_abab_04, 99_corner_00, 99_corner_01, 99_corner_02
ケース名 結果 実行時間 メモリ
00_sample_00 AC 25 ms 792 KiB
00_sample_01 AC 27 ms 752 KiB
00_sample_02 AC 25 ms 804 KiB
01_small_00 AC 25 ms 792 KiB
01_small_01 AC 24 ms 800 KiB
01_small_02 AC 23 ms 920 KiB
01_small_03 AC 24 ms 924 KiB
01_small_04 AC 27 ms 748 KiB
01_small_05 AC 26 ms 796 KiB
01_small_06 AC 27 ms 748 KiB
01_small_07 AC 23 ms 796 KiB
01_small_08 AC 24 ms 736 KiB
01_small_09 AC 23 ms 796 KiB
01_small_10 AC 23 ms 912 KiB
01_small_11 AC 24 ms 796 KiB
01_small_12 AC 23 ms 920 KiB
01_small_13 AC 23 ms 920 KiB
01_small_14 AC 23 ms 920 KiB
01_small_15 AC 23 ms 804 KiB
01_small_16 AC 24 ms 796 KiB
01_small_17 AC 24 ms 924 KiB
01_small_18 AC 24 ms 928 KiB
01_small_19 AC 24 ms 800 KiB
02_large_00 AC 24 ms 924 KiB
02_large_01 AC 24 ms 804 KiB
02_large_02 AC 24 ms 840 KiB
02_large_03 AC 24 ms 928 KiB
02_large_04 AC 25 ms 804 KiB
02_large_05 AC 28 ms 928 KiB
02_large_06 AC 22 ms 804 KiB
02_large_07 AC 24 ms 676 KiB
02_large_08 AC 26 ms 920 KiB
02_large_09 AC 25 ms 920 KiB
03_max_00 AC 24 ms 924 KiB
03_max_01 AC 25 ms 920 KiB
03_max_02 AC 24 ms 796 KiB
03_max_03 AC 26 ms 668 KiB
03_max_04 AC 23 ms 920 KiB
03_max_05 AC 23 ms 792 KiB
04_abab_00 AC 26 ms 916 KiB
04_abab_01 AC 23 ms 924 KiB
04_abab_02 AC 23 ms 720 KiB
04_abab_03 AC 23 ms 804 KiB
04_abab_04 AC 24 ms 800 KiB
99_corner_00 AC 22 ms 672 KiB
99_corner_01 AC 24 ms 924 KiB
99_corner_02 AC 24 ms 672 KiB