結果

問題 No.471 直列回転機
ユーザー tnakao0123tnakao0123
提出日時 2016-12-21 15:19:21
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 332 ms / 3,141 ms
コード長 1,279 bytes
コンパイル時間 1,338 ms
コンパイル使用メモリ 82,544 KB
実行使用メモリ 24,276 KB
平均クエリ数 19589.39
最終ジャッジ日時 2023-09-02 03:48:09
合計ジャッジ時間 12,654 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
23,496 KB
testcase_01 AC 22 ms
23,616 KB
testcase_02 AC 22 ms
23,796 KB
testcase_03 AC 21 ms
24,000 KB
testcase_04 AC 22 ms
24,204 KB
testcase_05 AC 24 ms
23,604 KB
testcase_06 AC 23 ms
23,592 KB
testcase_07 AC 25 ms
24,156 KB
testcase_08 AC 39 ms
23,784 KB
testcase_09 AC 42 ms
23,616 KB
testcase_10 AC 32 ms
23,616 KB
testcase_11 AC 140 ms
24,132 KB
testcase_12 AC 263 ms
24,204 KB
testcase_13 AC 265 ms
23,784 KB
testcase_14 AC 286 ms
23,796 KB
testcase_15 AC 332 ms
23,328 KB
testcase_16 AC 23 ms
23,196 KB
testcase_17 AC 23 ms
23,580 KB
testcase_18 AC 22 ms
24,120 KB
testcase_19 AC 23 ms
23,760 KB
testcase_20 AC 291 ms
23,784 KB
testcase_21 AC 86 ms
24,120 KB
testcase_22 AC 265 ms
23,988 KB
testcase_23 AC 240 ms
23,772 KB
testcase_24 AC 157 ms
24,276 KB
testcase_25 AC 71 ms
23,376 KB
testcase_26 AC 281 ms
23,424 KB
testcase_27 AC 153 ms
23,172 KB
testcase_28 AC 171 ms
23,784 KB
testcase_29 AC 199 ms
23,352 KB
testcase_30 AC 103 ms
23,160 KB
testcase_31 AC 302 ms
23,808 KB
testcase_32 AC 250 ms
23,316 KB
testcase_33 AC 188 ms
24,264 KB
testcase_34 AC 285 ms
23,796 KB
testcase_35 AC 88 ms
23,592 KB
testcase_36 AC 132 ms
23,148 KB
testcase_37 AC 48 ms
23,592 KB
testcase_38 AC 67 ms
23,640 KB
testcase_39 AC 115 ms
23,760 KB
testcase_40 AC 213 ms
23,784 KB
testcase_41 AC 290 ms
23,808 KB
testcase_42 AC 203 ms
23,148 KB
testcase_43 AC 260 ms
23,424 KB
testcase_44 AC 57 ms
23,412 KB
testcase_45 AC 188 ms
24,192 KB
testcase_46 AC 214 ms
23,160 KB
testcase_47 AC 269 ms
23,784 KB
testcase_48 AC 241 ms
23,424 KB
testcase_49 AC 222 ms
23,364 KB
testcase_50 AC 271 ms
23,784 KB
testcase_51 AC 128 ms
23,184 KB
testcase_52 AC 24 ms
23,784 KB
testcase_53 AC 26 ms
23,196 KB
testcase_54 AC 24 ms
23,388 KB
testcase_55 AC 93 ms
23,484 KB
testcase_56 AC 78 ms
23,352 KB
testcase_57 AC 61 ms
23,772 KB
testcase_58 AC 33 ms
24,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 471.cc: No.471 直列回転機 - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_M = 50000;

/* typedef */

/* global variables */

int xs[MAX_M], ys[MAX_M];

/* subroutines */

void ask(int x, int y, int &xd, int &yd) {
  printf("? %d %d\n", x, y); fflush(stdout);
  scanf("%d%d", &xd, &yd);
}

/* main */

int main() {
  int m;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) scanf("%d%d", xs + i, ys + i);

  // x' = ax + by + c
  // y' = dx + ey + f
  int a, b, c, d, e, f;

  // (0, 0) -> (c, f)
  ask(0, 0, c, f);

  // (1, 0) -> (a + c, d + f)
  int ac, df;
  ask(1, 0, ac, df);
  a = ac - c;
  d = df - f;

  // (0, 1) -> (b + c, e + f);
  int bc, ef;
  ask(0, 1, bc, ef);
  b = bc - c;
  e = ef - f;

  putchar('!'); putchar('\n');
  for (int i = 0; i < m; i++) {
    int x = a * xs[i] + b * ys[i] + c;
    int y = d * xs[i] + e * ys[i] + f;
    printf("%d %d\n", x, y);
  }
  fflush(stdout);

  return 0;
}

0