結果
問題 |
No.471 直列回転機
|
ユーザー |
![]() |
提出日時 | 2016-12-07 18:31:19 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 576 ms / 3,141 ms |
コード長 | 1,653 bytes |
コンパイル時間 | 1,289 ms |
コンパイル使用メモリ | 111,424 KB |
実行使用メモリ | 25,728 KB |
平均クエリ数 | 19588.39 |
最終ジャッジ日時 | 2024-06-11 10:13:25 |
合計ジャッジ時間 | 17,819 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 58 |
コンパイルメッセージ
main.cpp: In function 'int main(int, char**)': main.cpp:69:11: warning: narrowing conversion of 'round(cos((((double)rot * PI) / 1.8e+2)))' from 'double' to 'long long int' [-Wnarrowing] 69 | {round(cos(rot*PI/180.0)), round(-sin(rot*PI/180.0)), ax}, | ~~~~~^~~~~~~~~~~~~~~~~~~ main.cpp:69:11: warning: narrowing conversion of 'round(cos((((double)rot * PI) / 1.8e+2)))' from 'double' to 'long long int' [-Wnarrowing] main.cpp:69:37: warning: narrowing conversion of 'round((- sin((((double)rot * PI) / 1.8e+2))))' from 'double' to 'long long int' [-Wnarrowing] 69 | {round(cos(rot*PI/180.0)), round(-sin(rot*PI/180.0)), ax}, | ~~~~~^~~~~~~~~~~~~~~~~~~~ main.cpp:69:37: warning: narrowing conversion of 'round((- sin((((double)rot * PI) / 1.8e+2))))' from 'double' to 'long long int' [-Wnarrowing] main.cpp:70:11: warning: narrowing conversion of 'round(sin((((double)rot * PI) / 1.8e+2)))' from 'double' to 'long long int' [-Wnarrowing] 70 | {round(sin(rot*PI/180.0)), round(cos(rot*PI/180.0)), ay}, | ~~~~~^~~~~~~~~~~~~~~~~~~ main.cpp:70:11: warning: narrowing conversion of 'round(sin((((double)rot * PI) / 1.8e+2)))' from 'double' to 'long long int' [-Wnarrowing] main.cpp:70:37: warning: narrowing conversion of 'round(cos((((double)rot * PI) / 1.8e+2)))' from 'double' to 'long long int' [-Wnarrowing] 70 | {round(sin(rot*PI/180.0)), round(cos(rot*PI/180.0)), ay}, | ~~~~~^~~~~~~~~~~~~~~~~~~ main.cpp:70:37: warning: narrowing conversion of 'round(cos((((double)rot * PI) / 1.8e+2)))' from 'double' to 'long long int' [-Wnarrowing] main.cpp:64:11: warning: 'rot' may be used uninitialized [-Wmaybe-uninitialized] 64 | cerr << rot << endl; | ^~~ main.cpp:53:7: note: 'rot' was declared here 53 | int rot; | ^~~
ソースコード
#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 ax,ay; cin >> ax >> ay; cout << "? " << 1 << " " << 0 << endl; long long bx,by; cin >> bx >> by; long long dx = bx-ax; long long dy = by-ay; int rot; if(dx == 1){ rot = 0; }else if(dx == -1){ rot = 180; }else if(dy == 1){ rot = 90; }else if(dy == -1){ rot = 270; } cerr << rot << endl; double PI = acos(-1.0); vector<vector<long long>> A = { {round(cos(rot*PI/180.0)), round(-sin(rot*PI/180.0)), ax}, {round(sin(rot*PI/180.0)), round(cos(rot*PI/180.0)), ay}, {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; }