/* -*- coding: utf-8 -*- * * 1317.cc: No.1317 月曜日の朝、WAを出した - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int M = 6; const char ss[M][8] = { "AC", "WA", "TLE", "MLE", "OLE", "RE" }; enum { AC, WA, TLE, MLE, OLE, RE }; /* typedef */ /* global variables */ int cs[2][M]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); while (n--) { for (int i = 0; i < 2; i++) for (int j = 0; j < M; j++) scanf("%d", cs[i] + j); char s[8]; scanf("%s", s); int x = 0; for (; strcmp(s, ss[x]) != 0; x++); //puts(ss[x]); int wsum = 0; for (int j = 1; j < M; j++) wsum += cs[0][j]; bool ok = true; for (int j = 1; ok && j < M; j++) ok = (j == x && cs[1][j] >= wsum) || (j != x && cs[1][j] == 0); if (ok) puts("Yes"); else puts("No"); } return 0; }