제출 #1239746

#제출 시각아이디문제언어결과실행 시간메모리
1239746woeLight Bulbs (EGOI24_lightbulbs)Pypy 3
0 / 100
135 ms48832 KiB
import sys def flush(): sys.stdout.flush() def query(grid): print("?") for row in grid: print("".join(row)) flush() return int(input()) def main(): N = int(input()) orientation = [['0'] * N for _ in range(N)] # Detect orientation of each lamp lamp_types = [] for i in range(N): # Light up only one lamp at a time grid = [['0'] * N for _ in range(N)] grid[i][i] = '1' lit = query(grid) # If one lamp lights up full row, it is horizontal if lit == N: lamp_types.append('H') else: lamp_types.append('V') # Decide which lamps to turn on to light full grid result = [['0'] * N for _ in range(N)] for i in range(N): if lamp_types[i] == 'H': result[i][i] = '1' # One per row else: result[i][i] = '1' # One per column print("!") for row in result: print("".join(row)) flush() if __name__ == "__main__": main()

컴파일 시 표준 출력 (stdout) 메시지

Compiling 'Main.py'...

=======
  adding: __main__.pyc (deflated 49%)

=======
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...