結果
| 問題 |
No.471 直列回転機
|
| コンテスト | |
| ユーザー |
koyumeishi
|
| 提出日時 | 2016-12-07 18:32:24 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 565 ms / 3,141 ms |
| コード長 | 1,440 bytes |
| コンパイル時間 | 1,395 ms |
| コンパイル使用メモリ | 111,052 KB |
| 実行使用メモリ | 25,604 KB |
| 平均クエリ数 | 19589.39 |
| 最終ジャッジ日時 | 2024-06-11 10:13:03 |
| 合計ジャッジ時間 | 18,198 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 58 |
ソースコード
#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;
}
koyumeishi