結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 27 ms
24,336 KB
testcase_01 AC 25 ms
23,532 KB
testcase_02 AC 25 ms
23,244 KB
testcase_03 AC 26 ms
24,336 KB
testcase_04 AC 25 ms
23,628 KB
testcase_05 AC 27 ms
23,400 KB
testcase_06 AC 26 ms
23,832 KB
testcase_07 AC 28 ms
24,336 KB
testcase_08 AC 76 ms
23,640 KB
testcase_09 AC 78 ms
23,688 KB
testcase_10 AC 51 ms
24,060 KB
testcase_11 AC 239 ms
23,856 KB
testcase_12 AC 483 ms
23,856 KB
testcase_13 AC 498 ms
24,036 KB
testcase_14 AC 535 ms
24,060 KB
testcase_15 AC 598 ms
23,628 KB
testcase_16 AC 28 ms
23,376 KB
testcase_17 AC 25 ms
24,048 KB
testcase_18 AC 26 ms
24,012 KB
testcase_19 AC 26 ms
23,412 KB
testcase_20 AC 573 ms
24,288 KB
testcase_21 AC 122 ms
23,856 KB
testcase_22 AC 492 ms
23,616 KB
testcase_23 AC 466 ms
23,412 KB
testcase_24 AC 283 ms
23,832 KB
testcase_25 AC 93 ms
24,288 KB
testcase_26 AC 563 ms
23,628 KB
testcase_27 AC 268 ms
23,400 KB
testcase_28 AC 320 ms
23,568 KB
testcase_29 AC 358 ms
24,024 KB
testcase_30 AC 149 ms
24,324 KB
testcase_31 AC 554 ms
23,424 KB
testcase_32 AC 463 ms
23,388 KB
testcase_33 AC 354 ms
24,336 KB
testcase_34 AC 539 ms
24,312 KB
testcase_35 AC 122 ms
23,508 KB
testcase_36 AC 225 ms
23,628 KB
testcase_37 AC 72 ms
24,024 KB
testcase_38 AC 110 ms
23,436 KB
testcase_39 AC 183 ms
23,412 KB
testcase_40 AC 379 ms
24,348 KB
testcase_41 AC 583 ms
24,276 KB
testcase_42 AC 353 ms
24,012 KB
testcase_43 AC 520 ms
23,856 KB
testcase_44 AC 67 ms
23,424 KB
testcase_45 AC 351 ms
24,060 KB
testcase_46 AC 399 ms
23,844 KB
testcase_47 AC 528 ms
23,700 KB
testcase_48 AC 460 ms
23,616 KB
testcase_49 AC 440 ms
23,412 KB
testcase_50 AC 511 ms
24,060 KB
testcase_51 AC 215 ms
24,336 KB
testcase_52 AC 30 ms
23,580 KB
testcase_53 AC 32 ms
24,060 KB
testcase_54 AC 32 ms
23,640 KB
testcase_55 AC 137 ms
24,300 KB
testcase_56 AC 115 ms
24,060 KB
testcase_57 AC 74 ms
23,448 KB
testcase_58 AC 48 ms
24,060 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main(int, char**)’ 内:
main.cpp:69:11: 警告: 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: 警告: narrowing conversion of ‘round(cos((((double)rot * PI) / 1.8e+2)))’ from ‘double’ to ‘long long int’ [-Wnarrowing]
main.cpp:69:37: 警告: 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: 警告: narrowing conversion of ‘round((- sin((((double)rot * PI) / 1.8e+2))))’ from ‘double’ to ‘long long int’ [-Wnarrowing]
main.cpp:70:11: 警告: 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: 警告: narrowing conversion of ‘round(sin((((double)rot * PI) / 1.8e+2)))’ from ‘double’ to ‘long long int’ [-Wnarrowing]
main.cpp:70:37: 警告: 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: 警告: narrowing conversion of ‘round(cos((((double)rot * PI) / 1.8e+2)))’ from ‘double’ to ‘long long int’ [-Wnarrowing]
main.cpp:64:11: 警告: ‘rot’ may be used uninitialized [-Wmaybe-uninitialized]
   64 |   cerr << rot << endl;
      |           ^~~
main.cpp:53:7: 備考: ‘rot’ はここで定義されています
   53 |   int rot;
      |       ^~~

ソースコード

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 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;
}
0