結果
問題 | No.471 直列回転機 |
ユーザー | koyumeishi |
提出日時 | 2016-12-07 18:31:19 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.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 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 22 ms
24,580 KB |
testcase_01 | AC | 21 ms
24,940 KB |
testcase_02 | AC | 21 ms
24,556 KB |
testcase_03 | AC | 20 ms
25,196 KB |
testcase_04 | AC | 19 ms
25,196 KB |
testcase_05 | AC | 24 ms
24,812 KB |
testcase_06 | AC | 22 ms
25,196 KB |
testcase_07 | AC | 21 ms
25,196 KB |
testcase_08 | AC | 75 ms
25,580 KB |
testcase_09 | AC | 68 ms
25,184 KB |
testcase_10 | AC | 52 ms
24,812 KB |
testcase_11 | AC | 212 ms
24,812 KB |
testcase_12 | AC | 443 ms
25,092 KB |
testcase_13 | AC | 478 ms
25,220 KB |
testcase_14 | AC | 476 ms
25,220 KB |
testcase_15 | AC | 576 ms
24,964 KB |
testcase_16 | AC | 25 ms
24,952 KB |
testcase_17 | AC | 21 ms
25,580 KB |
testcase_18 | AC | 20 ms
24,940 KB |
testcase_19 | AC | 19 ms
25,580 KB |
testcase_20 | AC | 514 ms
25,208 KB |
testcase_21 | AC | 112 ms
25,208 KB |
testcase_22 | AC | 451 ms
24,824 KB |
testcase_23 | AC | 427 ms
24,952 KB |
testcase_24 | AC | 258 ms
25,208 KB |
testcase_25 | AC | 82 ms
24,824 KB |
testcase_26 | AC | 513 ms
24,952 KB |
testcase_27 | AC | 248 ms
25,208 KB |
testcase_28 | AC | 291 ms
24,824 KB |
testcase_29 | AC | 322 ms
25,208 KB |
testcase_30 | AC | 123 ms
24,952 KB |
testcase_31 | AC | 504 ms
25,592 KB |
testcase_32 | AC | 414 ms
24,952 KB |
testcase_33 | AC | 321 ms
24,952 KB |
testcase_34 | AC | 485 ms
24,952 KB |
testcase_35 | AC | 118 ms
25,208 KB |
testcase_36 | AC | 211 ms
25,208 KB |
testcase_37 | AC | 68 ms
24,952 KB |
testcase_38 | AC | 106 ms
24,952 KB |
testcase_39 | AC | 159 ms
25,172 KB |
testcase_40 | AC | 364 ms
25,208 KB |
testcase_41 | AC | 534 ms
25,464 KB |
testcase_42 | AC | 320 ms
24,824 KB |
testcase_43 | AC | 472 ms
25,592 KB |
testcase_44 | AC | 59 ms
25,208 KB |
testcase_45 | AC | 324 ms
24,952 KB |
testcase_46 | AC | 352 ms
24,824 KB |
testcase_47 | AC | 479 ms
24,824 KB |
testcase_48 | AC | 408 ms
25,208 KB |
testcase_49 | AC | 410 ms
25,208 KB |
testcase_50 | AC | 463 ms
24,824 KB |
testcase_51 | AC | 196 ms
24,568 KB |
testcase_52 | AC | 30 ms
25,196 KB |
testcase_53 | AC | 28 ms
25,196 KB |
testcase_54 | AC | 29 ms
24,812 KB |
testcase_55 | AC | 129 ms
25,580 KB |
testcase_56 | AC | 95 ms
24,812 KB |
testcase_57 | AC | 68 ms
25,728 KB |
testcase_58 | AC | 49 ms
25,196 KB |
コンパイルメッセージ
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; }