| 模型 | 模型答案 | 正确答案 |
|---|---|---|
| 金声玉亮2.0 | ```python import sys def is_extended_abc_string(s): if not s: return True a_count = 0 b_count = 0 c_count = 0 for char in s: if char == 'A': if b_count > 0 or c_count > 0: return False a_count += 1 elif char == 'B': if c_count > 0: return False b_count += 1 elif char == 'C': c_count += 1 return True s = input().strip() if is_extended_abc_string(s): print("Yes") else: print("No") ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |
| deepseek-r1 | ```python # Read the input string S = input().strip() index = 0 # Process A's while index < len(S) and S[index] == 'A': index += 1 # Process B's while index < len(S) and S[index] == 'B': index += 1 # Process C's while index < len(S) and S[index] == 'C': index += 1 # Check if all characters were processed if index == len(S): print("Yes") else: print("No") ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |
| gpto1 | ```python # YOUR CODE HERE S = input() n = len(S) i = 0 # Process 'A's while i < n and S[i] == 'A': i += 1 # Process 'B's while i < n and S[i] == 'B': i += 1 # Process 'C's while i < n and S[i] == 'C': i += 1 # Check if reached the end if i == n: print('Yes') else: print('No') ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |
| gpt-4o-2024-08-06 | ```python # YOUR CODE HERE def is_extended_abc_string(s): # We need to find a point where the string can be split into A's, B's, and C's n = len(s) i = 0 # Count the A's while i < n and s[i] == 'A': i += 1 # Count the B's while i < n and s[i] == 'B': i += 1 # Count the C's while i < n and s[i] == 'C': i += 1 # If we have reached the end of the string, it means the string is an Extended ABC string return i == n # Read input import sys input = sys.stdin.read s = input().strip() # Check if the string is an Extended ABC string if is_extended_abc_string(s): print("Yes") else: print("No") ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |
| DeepSeek-Coder-V2-Lite-Instruct | ```python # YOUR CODE HERE def is_extended_abc_string(S): # Initialize indices to track the positions of A, B, and C in the string index_a = 0 index_b = 0 index_c = 0 # Iterate through the string S for char in S: if char == 'A': index_a += 1 elif char == 'B': index_b += 1 elif char == 'C': index_c += 1 else: # If the character is not A, B, or C, it's an invalid character return "No" # Check if the counts of A, B, and C are consistent with an Extended ABC string if index_a % 3 == 0 and index_b % 3 == 0 and index_c % 3 == 0: return "Yes" else: return "No" # Read input from stdin S = input().strip() # Print the result print(is_extended_abc_string(S)) ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |
| Meta-Llama-3.1-405B-Instruct-Turbo | ```python import sys def is_extended_abc_string(s): if not s: return True a_count = 0 b_count = 0 c_count = 0 for char in s: if char == 'A': if b_count > 0 or c_count > 0: return False a_count += 1 elif char == 'B': if c_count > 0: return False b_count += 1 elif char == 'C': c_count += 1 return True s = input().strip() if is_extended_abc_string(s): print("Yes") else: print("No") ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |
| Meta-Llama-3.1-70B-Instruct-Turbo | ```python import sys def solve(): s = input() a = 0 b = 0 c = 0 for char in s: if char == 'A': a += 1 elif char == 'B': if a == 0: print("No") return b += 1 elif char == 'C': if a == 0 or b == 0: print("No") return c += 1 print("Yes") if __name__ == "__main__": solve() ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |
| Qwen2-72B-Instruct | ```python s = input() a = s.find('B') b = s.rfind('B') if a == -1 or b == -1 or a != s.find('C') or b != s.rfind('C'): print('No') else: print('Yes' if set(s[:a]) == {'A'} and set(s[a:b+1]) == {'B'} and set(s[b+1:]) == {'C'} else 'No') ``` ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |
| baichuan4 | ```python # YOUR CODE HERE def is_extended_abc_string(s): # Initialize pointers for A, B, and C segments a_start = b_start = c_start = 0 # Iterate through the string for i in range(len(s)): if s[i] == 'A': # If we encounter an 'A' after a 'B' or 'C', return False if b_start > 0 or c_start > 0: return "No" a_start = i elif s[i] == 'B': # If we encounter a 'B' after an 'A', start the B segment if a_start > 0: b_start = i elif s[i] == 'C': # If we encounter a 'C' after a 'B', start the C segment if b_start > 0: c_start = i # Check if all segments are valid return "Yes" if a_start >= 0 and b_start >= 0 and c_start >= 0 else "No" # Read input from stdin input_string = input() # Output the result print(is_extended_abc_string(input_string)) ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |
| doubao | ```python S = input() a_count = 0 b_count = 0 c_count = 0 current_char = None for char in S: if char == 'A': if current_char == 'B' or current_char == 'C': break a_count += 1 elif char == 'B': if current_char == 'C': break b_count += 1 current_char = 'B' elif char == 'C': c_count += 1 current_char = 'C' if a_count > 0 and b_count > 0 and c_count > 0 and current_char == 'C': print('Yes') else: print('No') ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |
| gpto1 | ```python # YOUR CODE HERE S = input() n = len(S) i = 0 # Process 'A's while i < n and S[i] == 'A': i += 1 # Process 'B's while i < n and S[i] == 'B': i += 1 # Process 'C's while i < n and S[i] == 'C': i += 1 # Check if reached the end if i == n: print('Yes') else: print('No') ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |
| kimi | ```python def is_extended_abc(s): if len(s) == 0: return True for i in range(1, len(s)): if s[:i] == ''.join(['A'] * i) and s[i:-1] == ''.join(['B'] * (len(s) - i - 1)) and s[-1:] == ''.join(['C'] * 1): return True return False s = input() if is_extended_abc(s): print('Yes') else: print('No') ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |
| minimax | ```python # YOUR CODE HERE input_string = input() extended_a = extended_b = extended_c = "" for char in input_string: if char == 'A': extended_a += char extended_b = extended_c = "" elif char == 'B': extended_b += char extended_c = "" elif char == 'C': extended_c += char else: # If any character other than A, B, or C is encountered, it's not an Extended ABC string print("No") break else: # If the entire string is traversed without breaking, check if all three parts are non-empty if extended_a and extended_b and extended_c: print("Yes") else: print("No") ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |
| wenxinyiyan | ```python # Read the input string s = input() # Initialize flags to track the occurrence of characters found_a = False found_b = False found_c = False # Flag to track if characters are in correct order is_extended_abc = True # Iterate over each character in the string for char in s: if char == 'A': # If we have already found B or C, then the string is not an Extended ABC string if found_b or found_c: is_extended_abc = False break found_a = True elif char == 'B': # If we have already found C or we haven't found A yet, then the string is not an Extended ABC string if found_c or not found_a: is_extended_abc = False break found_b = True elif char == 'C': # If we haven't found A or B yet, then the string is not an Extended ABC string if not found_a or not found_b: is_extended_abc = False break found_c = True # Print the result if is_extended_abc: print('Yes') else: print('No') ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |
| zhipu | ```python def is_extended_abc_string(s): # Check if the string can be split into three parts: A's, B's, and C's # First, find the transition points from A to B and B to C try: first_b = s.index('B') first_c = s.index('C', first_b) except ValueError: # If B or C is not found, it cannot be an Extended ABC string return "No" # Check if all characters before first_b are 'A' if any(c != 'A' for c in s[:first_b]): return "No" # Check if all characters between first_b and first_c are 'B' if any(c != 'B' for c in s[first_b:first_c]): return "No" # Check if all characters after first_c are 'C' if any(c != 'C' for c in s[first_c:]): return "No" return "Yes" def main(): import sys input = sys.stdin.read s = input().strip() result = is_extended_abc_string(s) print(result) if __name__ == "__main__": main() ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |
| deepseek-v3 | ```python # YOUR CODE HERE def is_extended_abc_string(s): # Split the string into three parts based on the order A, B, C # Find the first occurrence of B first_b = s.find('B') if first_b == -1: # No B, check if all are A or all are C if all(c == 'A' for c in s) or all(c == 'C' for c in s): return True else: return False # Find the first occurrence of C first_c = s.find('C') if first_c == -1: # No C, check if all are A or all are B if all(c == 'A' for c in s) or all(c == 'B' for c in s): return True else: return False # Now, we have at least one B and one C # The A part should be before the first B a_part = s[:first_b] # The B part should be between the first B and the first C b_part = s[first_b:first_c] # The C part should be after the first C c_part = s[first_c:] # Check if each part is valid if all(c == 'A' for c in a_part) and all(c == 'B' for c in b_part) and all(c == 'C' for c in c_part): return True else: return False # Read input S = input().strip() # Check if it is an Extended ABC string if is_extended_abc_string(S): print("Yes") else: print("No") ``` |
[{"input": "AAABBBCCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ACABABCBC\n", "output": "No\n", "testtype": "stdin"}, {"input": "A\n", "output": "Yes\n", "testtype": "stdin"}, {"input": "ABBBBBBBBBBBBBCCCCCC\n", "output": "Yes\n", "testtype": "stdin"}] |