루미 알고리즘

#1377플래티넘Tic-Tac-Toe

PO 2016 지역 대회코딩출제 Johan Sannemo, Simon Lindholm영어 원문이 문제가 어렵다면 — 배우는 순서 보기

영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)

Problem

Mårten is extremely good at tic-tac-toe. He's so good you've never managed to beat him. Write a program that plays tic-tac-toe for you, and you might have a chance.

If you don't know the rules of the game, you can read them on Wikipedia (https://en.wikipedia.org/wiki/Tic_tac_toe).

Interactivity

This problem is interactive. First, you should read one line containing either first or second, depending on whether you move first or not.

Then, you should repeatedly read in a tic-tac-toe grid containing the current game state (blank if you're making the first move, otherwise containing Mårten's last move). After reading the grid, you should output a grid with the move you performed.

If you output a grid where you win or play a draw your program should terminate. If you read a grid where Mårten won or drew your program should terminate.

A grid is output and read as a 3 lines with 3 characters each – . for an empty square, o for Mårten's pieces, or x for your pieces (note lower-case letters).

Grading

Your solution will be tested on several groups of test cases. To get points for a group you need to pass all the tests of that group.

GroupPointsConstraints
120You must play a valid game.
225You must never lose a game.
330You must always win a game if possible.
425You must never lose a game and you must always win a game if possible.

출처 표기

출처: Programmeringsolympiaden 2016년 지역 대회 · 원문 페이지 · 이용 조건 CC BY-SA · LaTeX 원문을 화면용 글로 옮겼습니다(수식·표의 모양이 다를 수 있습니다). 내용은 고치지 않았습니다.

크리에이티브 커먼즈 저작자표시-동일조건변경허락.

문제 출처: 한국정보올림피아드(KOI) (CC BY-NC-SA 4.0) · International Olympiad in Informatics (IOI) (CC BY) · Centre for Education in Mathematics and Computing (CEMC), University of Waterloo (CC BY-NC 4.0) · Programmeringsolympiaden (CC BY-SA) · CSES Problem Set (Antti Laaksonen) (CC BY-NC-SA 4.0). 루미 알고리즘은 위 단체들과 관계없는 별도의 서비스이며, 자료는 원문 그대로 싣습니다. 문제마다 출처와 이용 조건을 따로 표기합니다.