提出 #577145


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()

int main()
{
	string s, t;
	cin >> s >> t;
	bool f = false;
	int ps = 0, pt = 0;
	REP(i, s.size())
	{
		if (i % 2 == 0) 
		{
			if (ps == s.size()) goto next;
			while (s[i] != s[ps])
			{
				ps++;
				if (ps == s.size()) goto next;
			}
			ps++;
		}
		else
		{
			if (pt == t.size()) goto next;
			while (s[i] != t[pt])
			{
				pt++;
				if (pt == t.size()) goto next;
			}
			pt++;
		}
		if (i == s.size() - 1) f = true;
	}
next:;
	ps = 0; pt = 0;
	REP(i, s.size())
	{
		if (i % 2 == 1)
		{
			if (ps == s.size()) goto end;
			while (s[i] != s[ps])
			{
				ps++;
				if (ps == s.size()) goto end;
			}
			ps++;
		}
		else
		{
			if (pt == t.size()) goto end;
			while (s[i] != t[pt])
			{
				pt++;
				if (pt == t.size()) goto end;
			}
			pt++;
		}
		if (i == s.size() - 1) f = true;
	}
end:;
	puts(f ? "Yes" : "No");
	return 0;
}

提出情報

提出日時
問題 A - M and A
ユーザ lungman
言語 C++11 (GCC 4.8.1)
得点 100
コード長 1061 Byte
結果 AC
実行時間 27 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 27 ms 772 KiB
00_sample_01 AC 24 ms 924 KiB
00_sample_02 AC 24 ms 804 KiB
01_small_00 AC 24 ms 796 KiB
01_small_01 AC 24 ms 672 KiB
01_small_02 AC 24 ms 800 KiB
01_small_03 AC 24 ms 800 KiB
01_small_04 AC 24 ms 792 KiB
01_small_05 AC 26 ms 800 KiB
01_small_06 AC 24 ms 800 KiB
01_small_07 AC 25 ms 840 KiB
01_small_08 AC 25 ms 928 KiB
01_small_09 AC 24 ms 804 KiB
01_small_10 AC 23 ms 920 KiB
01_small_11 AC 24 ms 800 KiB
01_small_12 AC 24 ms 924 KiB
01_small_13 AC 24 ms 672 KiB
01_small_14 AC 23 ms 928 KiB
01_small_15 AC 23 ms 672 KiB
01_small_16 AC 24 ms 924 KiB
01_small_17 AC 24 ms 924 KiB
01_small_18 AC 23 ms 920 KiB
01_small_19 AC 24 ms 924 KiB
02_large_00 AC 23 ms 924 KiB
02_large_01 AC 24 ms 924 KiB
02_large_02 AC 23 ms 924 KiB
02_large_03 AC 24 ms 720 KiB
02_large_04 AC 25 ms 924 KiB
02_large_05 AC 25 ms 800 KiB
02_large_06 AC 24 ms 800 KiB
02_large_07 AC 23 ms 800 KiB
02_large_08 AC 23 ms 924 KiB
02_large_09 AC 23 ms 800 KiB
03_max_00 AC 22 ms 924 KiB
03_max_01 AC 23 ms 928 KiB
03_max_02 AC 24 ms 928 KiB
03_max_03 AC 24 ms 800 KiB
03_max_04 AC 24 ms 800 KiB
03_max_05 AC 22 ms 928 KiB
04_abab_00 AC 24 ms 672 KiB
04_abab_01 AC 22 ms 676 KiB
04_abab_02 AC 24 ms 800 KiB
04_abab_03 AC 24 ms 804 KiB
04_abab_04 AC 24 ms 800 KiB
99_corner_00 AC 24 ms 796 KiB
99_corner_01 AC 22 ms 800 KiB
99_corner_02 AC 24 ms 796 KiB