結果
問題 | No.471 直列回転機 |
ユーザー | Grenache |
提出日時 | 2016-12-21 22:13:45 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 636 ms / 3,141 ms |
コード長 | 4,521 bytes |
コンパイル時間 | 3,305 ms |
コンパイル使用メモリ | 78,584 KB |
実行使用メモリ | 67,104 KB |
平均クエリ数 | 19589.39 |
最終ジャッジ日時 | 2024-06-11 10:30:41 |
合計ジャッジ時間 | 27,955 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 127 ms
56,940 KB |
testcase_01 | AC | 115 ms
57,268 KB |
testcase_02 | AC | 135 ms
56,912 KB |
testcase_03 | AC | 133 ms
56,772 KB |
testcase_04 | AC | 136 ms
56,600 KB |
testcase_05 | AC | 155 ms
57,764 KB |
testcase_06 | AC | 130 ms
57,068 KB |
testcase_07 | AC | 165 ms
57,260 KB |
testcase_08 | AC | 255 ms
63,284 KB |
testcase_09 | AC | 254 ms
63,668 KB |
testcase_10 | AC | 224 ms
61,056 KB |
testcase_11 | AC | 359 ms
63,872 KB |
testcase_12 | AC | 550 ms
65,204 KB |
testcase_13 | AC | 555 ms
65,016 KB |
testcase_14 | AC | 600 ms
65,568 KB |
testcase_15 | AC | 636 ms
67,104 KB |
testcase_16 | AC | 155 ms
57,676 KB |
testcase_17 | AC | 114 ms
56,956 KB |
testcase_18 | AC | 130 ms
57,028 KB |
testcase_19 | AC | 134 ms
56,428 KB |
testcase_20 | AC | 603 ms
66,632 KB |
testcase_21 | AC | 296 ms
63,168 KB |
testcase_22 | AC | 552 ms
65,328 KB |
testcase_23 | AC | 523 ms
65,552 KB |
testcase_24 | AC | 388 ms
63,572 KB |
testcase_25 | AC | 279 ms
63,392 KB |
testcase_26 | AC | 582 ms
67,020 KB |
testcase_27 | AC | 394 ms
63,600 KB |
testcase_28 | AC | 430 ms
63,920 KB |
testcase_29 | AC | 457 ms
63,736 KB |
testcase_30 | AC | 318 ms
63,900 KB |
testcase_31 | AC | 606 ms
65,484 KB |
testcase_32 | AC | 510 ms
65,464 KB |
testcase_33 | AC | 459 ms
63,996 KB |
testcase_34 | AC | 551 ms
65,724 KB |
testcase_35 | AC | 299 ms
63,360 KB |
testcase_36 | AC | 362 ms
64,036 KB |
testcase_37 | AC | 261 ms
63,432 KB |
testcase_38 | AC | 281 ms
63,444 KB |
testcase_39 | AC | 340 ms
63,124 KB |
testcase_40 | AC | 465 ms
64,384 KB |
testcase_41 | AC | 606 ms
66,752 KB |
testcase_42 | AC | 458 ms
63,952 KB |
testcase_43 | AC | 564 ms
65,632 KB |
testcase_44 | AC | 255 ms
60,232 KB |
testcase_45 | AC | 467 ms
63,912 KB |
testcase_46 | AC | 463 ms
63,996 KB |
testcase_47 | AC | 567 ms
65,484 KB |
testcase_48 | AC | 498 ms
64,508 KB |
testcase_49 | AC | 497 ms
64,872 KB |
testcase_50 | AC | 564 ms
66,292 KB |
testcase_51 | AC | 360 ms
63,560 KB |
testcase_52 | AC | 174 ms
58,364 KB |
testcase_53 | AC | 151 ms
57,320 KB |
testcase_54 | AC | 158 ms
57,416 KB |
testcase_55 | AC | 313 ms
63,392 KB |
testcase_56 | AC | 290 ms
63,400 KB |
testcase_57 | AC | 267 ms
62,372 KB |
testcase_58 | AC | 220 ms
60,876 KB |
ソースコード
import java.io.*; import java.util.*; public class Main_yukicoder471 { private static Scanner sc; private static Printer pr; private static void solve() { int m = sc.nextInt(); int[] x = new int[m]; int[] y = new int[m]; for (int i = 0; i < m; i++) { x[i] = sc.nextInt(); y[i] = sc.nextInt(); } cmd("? 0 0"); long t02 = sc.nextLong(); long t12 = sc.nextLong(); cmd("? 1 0"); long t00 = sc.nextLong() - t02; long t10 = sc.nextLong() - t12; cmd("? 0 1"); long t01 = sc.nextLong() - t02; long t11 = sc.nextLong() - t12; cmd("!"); for (int i = 0; i < m; i++) { long rx = t00 * x[i] + t01 * y[i] + t02; long ry = t10 * x[i] + t11 * y[i] + t12; pr.printf("%d %d\n", rx, ry); } pr.flush(); } private static void cmd(String s) { pr.println(s); pr.flush(); } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } @SuppressWarnings("unused") private static class Scanner { BufferedReader br; Scanner (InputStream in) { br = new BufferedReader(new InputStreamReader(in)); } private boolean isPrintable(int ch) { return ch >= '!' && ch <= '~'; } private boolean isCRLF(int ch) { return ch == '\n' || ch == '\r' || ch == -1; } private int nextPrintable() { try { int ch; while (!isPrintable(ch = br.read())) { if (ch == -1) { throw new NoSuchElementException(); } } return ch; } catch (IOException e) { throw new NoSuchElementException(); } } String next() { try { int ch = nextPrintable(); StringBuilder sb = new StringBuilder(); do { sb.appendCodePoint(ch); } while (isPrintable(ch = br.read())); return sb.toString(); } catch (IOException e) { throw new NoSuchElementException(); } } int nextInt() { try { // parseInt from Integer.parseInt() boolean negative = false; int res = 0; int limit = -Integer.MAX_VALUE; int radix = 10; int fc = nextPrintable(); if (fc < '0') { if (fc == '-') { negative = true; limit = Integer.MIN_VALUE; } else if (fc != '+') { throw new NumberFormatException(); } fc = br.read(); } int multmin = limit / radix; int ch = fc; do { int digit = ch - '0'; if (digit < 0 || digit >= radix) { throw new NumberFormatException(); } if (res < multmin) { throw new NumberFormatException(); } res *= radix; if (res < limit + digit) { throw new NumberFormatException(); } res -= digit; } while (isPrintable(ch = br.read())); return negative ? res : -res; } catch (IOException e) { throw new NoSuchElementException(); } } long nextLong() { try { // parseLong from Long.parseLong() boolean negative = false; long res = 0; long limit = -Long.MAX_VALUE; int radix = 10; int fc = nextPrintable(); if (fc < '0') { if (fc == '-') { negative = true; limit = Long.MIN_VALUE; } else if (fc != '+') { throw new NumberFormatException(); } fc = br.read(); } long multmin = limit / radix; int ch = fc; do { int digit = ch - '0'; if (digit < 0 || digit >= radix) { throw new NumberFormatException(); } if (res < multmin) { throw new NumberFormatException(); } res *= radix; if (res < limit + digit) { throw new NumberFormatException(); } res -= digit; } while (isPrintable(ch = br.read())); return negative ? res : -res; } catch (IOException e) { throw new NoSuchElementException(); } } float nextFloat() { return Float.parseFloat(next()); } double nextDouble() { return Double.parseDouble(next()); } String nextLine() { try { int ch; while (isCRLF(ch = br.read())) { if (ch == -1) { throw new NoSuchElementException(); } } StringBuilder sb = new StringBuilder(); do { sb.appendCodePoint(ch); } while (!isCRLF(ch = br.read())); return sb.toString(); } catch (IOException e) { throw new NoSuchElementException(); } } void close() { try { br.close(); } catch (IOException e) { // throw new NoSuchElementException(); } } } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }