結果
| 問題 |
No.2749 随伴関手入門
|
| コンテスト | |
| ユーザー |
👑 |
| 提出日時 | 2023-04-05 10:04:31 |
| 言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 20 ms / 2,000 ms |
| コード長 | 1,092 bytes |
| コンパイル時間 | 970 ms |
| コンパイル使用メモリ | 74,192 KB |
| 最終ジャッジ日時 | 2025-02-11 23:00:11 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
#pragma GCC optimize ( "O3" )
#pragma GCC optimize( "unroll-loops" )
#pragma GCC target ( "sse4.2,fma,avx2,popcnt,lzcnt,bmi2" )
#include <iostream>
#include <cassert>
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 QUIT return 0
#define COUT( ANSWER ) cout << ( ANSWER ) << "\n";
#define RETURN( ANSWER ) COUT( ANSWER ); QUIT
int main()
{
UNTIE;
CEXPR( int , bound_N , 400 );
CIN_ASSERT( N , 1 , bound_N );
int k = 1;
int F[2] = { 0 , 1 };
int i_prev = 0;
int i_curr = 1;
while( true ){
int& F_prev = F[i_prev];
int& F_curr = F[i_curr];
( F_curr += F_prev ) %= N;
if( F_curr == 0 ){
RETURN( k );
}
k++;
swap( i_prev , i_curr );
}
QUIT;
}