結果

問題 No.471 直列回転機
ユーザー yuppe19 😺
提出日時 2017-03-30 18:34:32
言語 Python2
(2.7.18)
結果
AC  
実行時間 1,310 ms / 3,141 ms
コード長 1,539 bytes
コンパイル時間 237 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 28,896 KB
平均クエリ数 19589.39
最終ジャッジ日時 2024-06-11 10:39:49
合計ジャッジ時間 35,174 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 58
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python2
# -*- coding: utf-8 -*-
# †
import sys
from itertools import chain, repeat

def Struct(name, fields):
    fields = fields.replace(',', ' ').split()
    def __init__(self, *args):
        n, m = len(args), len(fields)
        if n > m:
            raise TypeError('__init__() takes at most {} arguments ({} given)'.format(m, n))
        args = chain(args, repeat(None))
        for field, value in zip(fields, args):
            setattr(self, field, value)
    def __str__(self):
        return '{}({})'.format(name, ', '.join('{}={}'.format(f, getattr(self, f)) for f in fields))
    def __getitem__(self, index):
        return getattr(self, fields[index])
    def __setitem__(self, index, value):
        setattr(self, fields[index], value)
    attrs = {
        '__slots__': fields,
        '__init__':  __init__,
        '__getitem__': __getitem__,
        '__setitem__': __setitem__,
        '__str__':  __str__,
        '__repr__': __str__,
    }
    return type(name, (object,), attrs)

P = Struct('P', 'x, y')

def nya(mes):
    print mes
    sys.stdout.flush()


M = int(raw_input())
points = [P(*map(int, raw_input().split())) for _ in xrange(M)]

nya('? 0 0')
p00 = P(*map(int, raw_input().split()))
nya('? 1 0')
p10 = P(*map(int, raw_input().split()))
p10.x -= p00.x
p10.y -= p00.y
nya('? 0 1')
p01 = P(*map(int, raw_input().split()))
p01.x -= p00.x
p01.y -= p00.y

nya('!')
for p in points:
    x = p10.x * p.x + p01.x * p.y + p00.x
    y = p10.y * p.x + p01.y * p.y + p00.y
    nya('{} {}'.format(x, y))
0