/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 15ms 3.047 MiB
#2 Wrong Answer 22ms 3.312 MiB

Code

def count_swaps(s):  
  zeros = 0
  ones = 0  
  for c in s:    
    if c == '0':
      zeros += 1    
      ones += 1  
  return min(zeros, ones)

t = int(input())
for _ in range(t):  
  n = int(input())  
  s = input()  
  print(count_swaps(s))

Information

Submit By
Type
Submission
Problem
P1016 Swap sort
Language
Python 3 (Python 3.12.3)
Submit At
2024-01-07 14:44:42
Judged At
2024-11-11 03:43:43
Judged By
Score
0
Total Time
22ms
Peak Memory
3.312 MiB