結果

問題 No.471 直列回転機
ユーザー koyumeishikoyumeishi
提出日時 2016-12-07 18:32:24
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 599 ms / 3,141 ms
コード長 1,440 bytes
コンパイル時間 1,308 ms
コンパイル使用メモリ 109,484 KB
実行使用メモリ 24,420 KB
平均クエリ数 19589.39
最終ジャッジ日時 2023-09-02 03:34:22
合計ジャッジ時間 20,814 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
23,412 KB
testcase_01 AC 26 ms
23,376 KB
testcase_02 AC 25 ms
23,616 KB
testcase_03 AC 26 ms
24,312 KB
testcase_04 AC 27 ms
23,544 KB
testcase_05 AC 28 ms
23,580 KB
testcase_06 AC 26 ms
24,324 KB
testcase_07 AC 28 ms
23,652 KB
testcase_08 AC 81 ms
24,036 KB
testcase_09 AC 75 ms
24,312 KB
testcase_10 AC 47 ms
23,844 KB
testcase_11 AC 236 ms
24,060 KB
testcase_12 AC 481 ms
24,288 KB
testcase_13 AC 492 ms
23,664 KB
testcase_14 AC 535 ms
23,628 KB
testcase_15 AC 599 ms
23,532 KB
testcase_16 AC 29 ms
24,396 KB
testcase_17 AC 27 ms
24,000 KB
testcase_18 AC 26 ms
23,412 KB
testcase_19 AC 27 ms
23,376 KB
testcase_20 AC 573 ms
24,060 KB
testcase_21 AC 120 ms
23,448 KB
testcase_22 AC 500 ms
23,616 KB
testcase_23 AC 482 ms
23,376 KB
testcase_24 AC 267 ms
24,336 KB
testcase_25 AC 91 ms
23,868 KB
testcase_26 AC 566 ms
24,324 KB
testcase_27 AC 261 ms
24,288 KB
testcase_28 AC 316 ms
23,664 KB
testcase_29 AC 361 ms
23,388 KB
testcase_30 AC 149 ms
23,412 KB
testcase_31 AC 552 ms
23,652 KB
testcase_32 AC 485 ms
24,012 KB
testcase_33 AC 355 ms
23,988 KB
testcase_34 AC 539 ms
24,324 KB
testcase_35 AC 125 ms
24,336 KB
testcase_36 AC 221 ms
23,232 KB
testcase_37 AC 69 ms
23,364 KB
testcase_38 AC 113 ms
24,000 KB
testcase_39 AC 195 ms
23,628 KB
testcase_40 AC 394 ms
23,448 KB
testcase_41 AC 569 ms
23,376 KB
testcase_42 AC 365 ms
24,324 KB
testcase_43 AC 523 ms
23,520 KB
testcase_44 AC 65 ms
23,640 KB
testcase_45 AC 353 ms
23,508 KB
testcase_46 AC 409 ms
23,580 KB
testcase_47 AC 537 ms
24,060 KB
testcase_48 AC 458 ms
23,628 KB
testcase_49 AC 447 ms
24,420 KB
testcase_50 AC 523 ms
24,300 KB
testcase_51 AC 218 ms
24,420 KB
testcase_52 AC 29 ms
23,628 KB
testcase_53 AC 30 ms
23,424 KB
testcase_54 AC 30 ms
24,036 KB
testcase_55 AC 137 ms
23,376 KB
testcase_56 AC 107 ms
23,424 KB
testcase_57 AC 80 ms
23,532 KB
testcase_58 AC 49 ms
23,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <complex>
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <map>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <functional>
#include <random>
#include <ctime>
#include "assert.h"

using namespace std;

//[n*p] * [p*m] => [n*m]
template<class T>
vector< vector<T> > multmat(const vector<vector<T> > &A, const vector<vector<T>> &B, int n, int p, int m){
  vector<vector<T> > C(n, vector<T>(m,0));
  for(int i=0; i<n; i++){
    for(int k=0; k<p; k++){
      for(int j=0; j<m; j++){
        C[i][j] += A[i][k] * B[k][j];
        //C[i][j] %= mod;
      }
    }
  }
  return C;
}

int main(int argc, char* argv[]){
	int m;
	cin >> m;
	vector<long long> px(m), py(m);
	for(int i=0; i<m; i++){
		cin >> px[i] >> py[i];
	}

  cout << "? " << 0 << " " << 0 << endl;
  long long dx,dy;
  cin >> dx >> dy;

  cout << "? " << 1 << " " << 0 << endl;
  vector<long long> r(4);
  cin >> r[0] >> r[2];
  r[0] -= dx;
  r[2] -= dy;

  cout << "? " << 0 << " " << 1 << endl;
  cin >> r[1] >> r[3];
  r[1] -= dx;
  r[3] -= dy;

  vector<vector<long long>> A = {
    {r[0],r[1],dx},
    {r[2],r[3],dy},
    {0,0,1}
  };

  cout << "!" << endl;
  for(int i=0; i<m; i++){
    vector<vector<long long>> v = {
      {px[i]},
      {py[i]},
      {1}
    };

    auto ans = multmat(A, v, 3,3,1);
    cout << ans[0][0] << " " << ans[1][0] << endl;
  }



	return 0;
}
0