結果

問題 No.3099 夜の道路は気をつけて運転しなければならない
ユーザー 👑 p-adicp-adic
提出日時 2023-03-11 21:21:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 3,303 bytes
コンパイル時間 1,036 ms
コンパイル使用メモリ 79,504 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-04 15:23:57
合計ジャッジ時間 1,460 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 AC 2 ms
6,816 KB
testcase_03 AC 2 ms
6,820 KB
testcase_04 AC 2 ms
6,820 KB
testcase_05 AC 2 ms
6,816 KB
testcase_06 AC 1 ms
6,816 KB
testcase_07 AC 2 ms
6,816 KB
testcase_08 AC 2 ms
6,816 KB
testcase_09 AC 2 ms
6,816 KB
testcase_10 AC 1 ms
6,816 KB
testcase_11 AC 2 ms
6,820 KB
testcase_12 AC 2 ms
6,820 KB
testcase_13 AC 2 ms
6,816 KB
testcase_14 AC 2 ms
6,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize ( "O3" )
#pragma GCC optimize( "unroll-loops" )
#pragma GCC target ( "sse4.2,fma,avx2,popcnt,lzcnt,bmi2" )
#include <iostream>
#include <stdio.h>
#include <stdint.h>
#include <cassert>
#include <iomanip>
using namespace std;

#define TYPE_OF( VAR ) remove_const<remove_reference<decltype( VAR )>::type >::type
#define UNTIE ios_base::sync_with_stdio( false ); cin.tie( nullptr )
#define CEXPR( LL , BOUND , VALUE ) constexpr const LL BOUND = VALUE
#define CIN( LL , A ) LL A; cin >> A
#define ASSERT( A , MIN , MAX ) assert( ( MIN ) <= A && A <= ( MAX ) )
#define CIN_ASSERT( A , MIN , MAX ) CIN( TYPE_OF( MAX ) , A ); ASSERT( A , MIN , MAX )
#define GETLINE( S ) string S; getline( cin , S ); int VARIABLE_FOR_INDEX_FOR_STOI_FOR_ ## S = 0; int VARIABLE_FOR_SIZE_FOR_STOI_FOR_ ## S = S.size()
#define GETLINE_SEPARATE( S , SEPARATOR ) string S; getline( cin , S , SEPARATOR )
#define QUIT return 0
#define DOUBLE( PRECISION , ANSWER ) cout << fixed << setprecision( PRECISION ) << ( ANSWER ) << "\n"; QUIT

// 入力フォーマットチェック用
// 余計な入力の有無を確認
#define CHECK_REDUNDANT_INPUT string VARIABLE_FOR_CHECK_REDUNDANT_INPUT = ""; cin >> VARIABLE_FOR_CHECK_REDUNDANT_INPUT; assert( VARIABLE_FOR_CHECK_REDUNDANT_INPUT == "" ); assert( ! cin )
// #define CHECK_REDUNDANT_INPUT string VARIABLE_FOR_CHECK_REDUNDANT_INPUT = ""; getline( cin , VARIABLE_FOR_CHECK_REDUNDANT_INPUT ); assert( VARIABLE_FOR_CHECK_REDUNDANT_INPUT == "" ); assert( ! cin )
// |N| <= BOUNDを満たすNをSから構築
#define STOI( S , N , BOUND ) TYPE_OF( BOUND ) N = 0; { bool VARIABLE_FOR_POSITIVITY_FOR_STOI = true; assert( VARIABLE_FOR_INDEX_FOR_STOI_FOR_ ## S < VARIABLE_FOR_SIZE_FOR_STOI_FOR_ ## S ); if( S.substr( VARIABLE_FOR_INDEX_FOR_STOI_FOR_ ## S , 1 ) == "-" ){ VARIABLE_FOR_POSITIVITY_FOR_STOI = false; VARIABLE_FOR_INDEX_FOR_STOI_FOR_ ## S ++; assert( VARIABLE_FOR_INDEX_FOR_STOI_FOR_ ## S < VARIABLE_FOR_SIZE_FOR_STOI_FOR_ ## S ); } assert( S.substr( VARIABLE_FOR_INDEX_FOR_STOI_FOR_ ## S , 1 ) != " " ); string VARIABLE_FOR_LETTER_FOR_STOI{}; int VARIABLE_FOR_DIGIT_FOR_STOI{}; while( VARIABLE_FOR_INDEX_FOR_STOI_FOR_ ## S < VARIABLE_FOR_SIZE_FOR_STOI_FOR_ ## S ? ( VARIABLE_FOR_LETTER_FOR_STOI = S.substr( VARIABLE_FOR_INDEX_FOR_STOI_FOR_ ## S , 1 ) ) != " " : false ){ VARIABLE_FOR_DIGIT_FOR_STOI = stoi( VARIABLE_FOR_LETTER_FOR_STOI ); assert( N < BOUND / 10 ? true : N == BOUND / 10 && VARIABLE_FOR_DIGIT_FOR_STOI <= BOUND % 10 ); N = N * 10 + VARIABLE_FOR_DIGIT_FOR_STOI; VARIABLE_FOR_INDEX_FOR_STOI_FOR_ ## S ++; } if( ! VARIABLE_FOR_POSITIVITY_FOR_STOI ){ N *= -1; } if( VARIABLE_FOR_INDEX_FOR_STOI_FOR_ ## S < VARIABLE_FOR_SIZE_FOR_STOI_FOR_ ## S ){ VARIABLE_FOR_INDEX_FOR_STOI_FOR_ ## S ++; } }
// 1行で入力される変数の個数が適切か確認(半角空白の個数+1を調べる)
#define COUNT_VARIABLE( S , VARIABLE_NUMBER ) { int size = S.size(); int count = 0; for( int i = 0 ; i < size ; i++ ){ if( S.substr( i , 1 ) == " " ){ count++; } } assert( count + 1 == VARIABLE_NUMBER ); }

int main()
{
  UNTIE;
  CEXPR( int , bound_T , 23 );
  CIN_ASSERT( T , 0 , bound_T );
  CEXPR( int , bound_SD , 1000 );
  CIN_ASSERT( S , 1 , bound_SD );
  CIN_ASSERT( D , 1 , bound_SD );
  CHECK_REDUNDANT_INPUT;
  DOUBLE( 6 , ( D * 1.0 ) / S );
}
0