結果

問題 No.48 ロボットの操縦
ユーザー momoyuumomoyuu
提出日時 2022-08-15 17:17:15
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 661 bytes
コンパイル時間 3,555 ms
コンパイル使用メモリ 273,520 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 04:57:07
合計ジャッジ時間 4,205 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 2 ms
6,948 KB
testcase_10 AC 2 ms
6,944 KB
testcase_11 AC 2 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,944 KB
testcase_14 AC 2 ms
6,940 KB
testcase_15 AC 2 ms
6,944 KB
testcase_16 AC 2 ms
6,944 KB
testcase_17 AC 2 ms
6,944 KB
testcase_18 AC 2 ms
6,944 KB
testcase_19 AC 2 ms
6,940 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 2 ms
6,940 KB
testcase_23 AC 2 ms
6,944 KB
testcase_24 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/bits/stl_pair.h:61,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/bits/stl_algobase.h:64,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/algorithm:60,
                 from /home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/x86_64-pc-linux-gnu/bits/stdc++.h:51,
                 from main.cpp:1:
In function 'constexpr std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = long long int]',
    inlined from 'int main()' at main.cpp:16:9:
/home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/bits/move.h:197:11: warning: 'X' is used uninitialized [-Wuninitialized]
  197 |       _Tp __tmp = _GLIBCXX_MOVE(__a);
      |           ^~~~~
main.cpp: In function 'int main()':
main.cpp:15:8: note: 'X' declared here
   15 |     ll X,Y,L;
      |        ^
In function 'constexpr std::_Require<std::__not_<std::__is_tuple_like<_Tp> >, std::is_move_constructible<_Tp>, std::is_move_assignable<_Tp> > std::swap(_Tp&, _Tp&) [with _Tp = long long int]',
    inlined from 'int main()' at main.cpp:16:9:
/home/linuxbrew/.linuxbrew/Cellar/gcc/13.2.0/include/c++/13/bits/move.h:198:11: warning: 'Y' is used uninitialized [-Wuninitialized]
  198 |       __a = _GLIBCXX_MOVE(__b);
      |           ^
main.cpp: In function 'int main()':
main.cpp:15:10: note: 'Y' declared here
   15 |     ll X,Y,L;
      |          ^

ソースコード

diff #

#include <bits/stdc++.h>

#define ll long long
#define ld long double
#define rep(i,a,b) for (int i = a; i < b; i++)
#define irep(i,a,b) for (int i = a; i > b; i--)
#define print(n) cout << n << endl
#define rup(a,b) (a+b-1)/b

using namespace std;

int main(){
    cout << fixed << setprecision(15);
    
    ll X,Y,L;
    swap(X,Y);
    cin >> X >> Y >> L;
    swap(X,Y);
    ll count = 0;
    if(!(Y == (ll)0)){
        if (X>= 0) count += 1;
        else count += 2;
    }else{
        if (X>=0) count += 0;
        else count += 2;
    }
    count += rup(abs(X),L);
    count += rup(abs(Y),L);
    print(count);
    
    //system("pause");
    return 0;
}
0