結果
問題 |
No.2174 3 O'clock Easy
|
ユーザー |
👑 |
提出日時 | 2022-12-26 22:46:27 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 932 bytes |
コンパイル時間 | 3,161 ms |
コンパイル使用メモリ | 212,384 KB |
最終ジャッジ日時 | 2025-02-09 21:03:58 |
ジャッジサーバーID (参考情報) |
judge2 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 |
ソースコード
#pragma GCC optimize ( "O3" ) #pragma GCC target ( "avx" ) #include <bits/stdc++.h> using namespace std; using ll = long long; #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 QUIT return 0 #define COUT( ANSWER ) cout << ( ANSWER ) << "\n"; #define RETURN( ANSWER ) COUT( ANSWER ); QUIT int main() { UNTIE; CEXPR( ll , bound_N , 10000 ); CIN_ASSERT( N , 1 , bound_N ); ll Nq = N / 3; ll Nq2 = ( Nq * ( Nq + 1 ) ) / 2; ll Nr = N % 3; RETURN( 27 * Nq2 * Nq2 + ( 6 * Nq2 - 1 ) * Nq + ( Nr == 0 ? 0 : Nr == 1 ? N : ( N * ( N + 1 ) - 1 ) ) ); }