結果
問題 | No.2755 行列の共役類 |
ユーザー | 👑 p-adic |
提出日時 | 2023-05-24 17:10:49 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 3,604 bytes |
コンパイル時間 | 968 ms |
コンパイル使用メモリ | 74,300 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-09 07:16:01 |
合計ジャッジ時間 | 28,275 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 7 ms
5,248 KB |
testcase_04 | AC | 6 ms
5,248 KB |
testcase_05 | AC | 4 ms
5,248 KB |
testcase_06 | AC | 4 ms
5,248 KB |
testcase_07 | AC | 9 ms
5,248 KB |
testcase_08 | AC | 5 ms
5,248 KB |
testcase_09 | AC | 4 ms
5,248 KB |
testcase_10 | AC | 3 ms
5,248 KB |
testcase_11 | AC | 3 ms
5,248 KB |
testcase_12 | AC | 3 ms
5,248 KB |
testcase_13 | AC | 11 ms
5,248 KB |
testcase_14 | AC | 4 ms
5,248 KB |
testcase_15 | AC | 2 ms
5,248 KB |
testcase_16 | AC | 3 ms
5,248 KB |
testcase_17 | AC | 10 ms
5,248 KB |
testcase_18 | AC | 5 ms
5,248 KB |
testcase_19 | AC | 3 ms
5,248 KB |
testcase_20 | AC | 13 ms
5,248 KB |
testcase_21 | AC | 12 ms
5,248 KB |
testcase_22 | AC | 5 ms
5,248 KB |
testcase_23 | AC | 5 ms
5,248 KB |
testcase_24 | AC | 5 ms
5,248 KB |
testcase_25 | AC | 4 ms
5,248 KB |
testcase_26 | AC | 4 ms
5,248 KB |
testcase_27 | AC | 16 ms
5,248 KB |
testcase_28 | AC | 14 ms
5,248 KB |
testcase_29 | AC | 5 ms
5,248 KB |
testcase_30 | AC | 17 ms
5,248 KB |
testcase_31 | AC | 18 ms
5,248 KB |
testcase_32 | AC | 9 ms
5,248 KB |
testcase_33 | AC | 4 ms
5,248 KB |
testcase_34 | AC | 5 ms
5,248 KB |
testcase_35 | AC | 4 ms
5,248 KB |
testcase_36 | AC | 3 ms
5,248 KB |
testcase_37 | AC | 5 ms
5,248 KB |
testcase_38 | AC | 6 ms
5,248 KB |
testcase_39 | AC | 10 ms
5,248 KB |
testcase_40 | AC | 18 ms
5,248 KB |
testcase_41 | AC | 12 ms
5,248 KB |
testcase_42 | AC | 25 ms
5,248 KB |
testcase_43 | AC | 14 ms
5,248 KB |
testcase_44 | AC | 5 ms
5,248 KB |
testcase_45 | AC | 5 ms
5,248 KB |
testcase_46 | AC | 3 ms
5,248 KB |
testcase_47 | AC | 4 ms
5,248 KB |
testcase_48 | AC | 17 ms
5,248 KB |
testcase_49 | AC | 3 ms
5,248 KB |
testcase_50 | AC | 5 ms
5,248 KB |
testcase_51 | AC | 2 ms
5,248 KB |
testcase_52 | AC | 3 ms
5,248 KB |
testcase_53 | AC | 3,428 ms
5,248 KB |
testcase_54 | AC | 1,704 ms
5,248 KB |
testcase_55 | AC | 1,042 ms
5,248 KB |
testcase_56 | TLE | - |
testcase_57 | AC | 1,758 ms
6,820 KB |
testcase_58 | AC | 3,293 ms
6,820 KB |
testcase_59 | AC | 1,321 ms
6,820 KB |
testcase_60 | AC | 3,295 ms
6,816 KB |
testcase_61 | AC | 8 ms
6,816 KB |
testcase_62 | TLE | - |
testcase_63 | AC | 1,609 ms
6,816 KB |
testcase_64 | AC | 792 ms
6,816 KB |
testcase_65 | AC | 3 ms
6,816 KB |
ソースコード
// 誤解法(O((連結成分数)×B(B/C)×(Bの素因数の個数))解)チェック #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 <string> using namespace std; #define MAIN main #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 FOR( VAR , INITIAL , FINAL_PLUS_ONE ) for( TYPE_OF( FINAL_PLUS_ONE ) VAR = INITIAL ; VAR < FINAL_PLUS_ONE ; VAR ++ ) #define QUIT return 0 #define COUT( ANSWER ) cout << ( ANSWER ) << "\n" #define RETURN( ANSWER ) COUT( ANSWER ); QUIT template <typename T> inline T Residue( const T& a , const T& p ){ return a >= 0 ? a % p : ( a % p ) + p; } #define POWER_MOD( ANSWER , ARGUMENT , EXPONENT , MODULO ) \ int ANSWER{ 1 }; \ { \ int ARGUMENT_FOR_SQUARE_FOR_POWER = ( MODULO + ( ( ARGUMENT ) % MODULO ) ) % MODULO; \ TYPE_OF( EXPONENT ) EXPONENT_FOR_SQUARE_FOR_POWER = ( EXPONENT ); \ while( EXPONENT_FOR_SQUARE_FOR_POWER != 0 ){ \ if( EXPONENT_FOR_SQUARE_FOR_POWER % 2 == 1 ){ \ ANSWER = ( ANSWER * ARGUMENT_FOR_SQUARE_FOR_POWER ) % MODULO; \ } \ ARGUMENT_FOR_SQUARE_FOR_POWER = ( ARGUMENT_FOR_SQUARE_FOR_POWER * ARGUMENT_FOR_SQUARE_FOR_POWER ) % MODULO; \ EXPONENT_FOR_SQUARE_FOR_POWER /= 2; \ } \ } \ #define CONVERT1( i , P ) \ int P ## 00 = i / d; \ coprime = true; \ FOR( n , 0 , num ){ \ if( P ## 00 % prime[n] == 0 ){ \ coprime = false; \ break; \ } \ } \ #define CONVERT2( i , P ) \ int P ## 01 = i % d; \ int MAIN() { UNTIE; CEXPR( int , bound_B , 600 ); CIN_ASSERT( B , 1 , bound_B ); CIN( int , C ); assert( 1 <= C && B % C == 0 ); int B_copy = B; int prime[4]; int euler = 1; int num = 0; FOR( i , 2 , B_copy ){ if( i * i > B_copy ){ break; } if( B_copy % i == 0 ){ prime[num++] = i; B_copy /= i; euler *= i - 1; while( B_copy % i == 0 ){ B_copy /= i; euler *= i; } } } if( B_copy > 1 ){ prime[num++] = B_copy; euler *= B_copy - 1; } int inv[bound_B]; FOR( i , 1 , B ){ POWER_MOD( i_inv , i , euler - 1 , B ); inv[i] = i_inv; } CEXPR( int , bound_Bd , bound_B * bound_B ); bool found[bound_Bd] = {}; int d = B / C; int Bd = B * d; int answer = 0; bool coprime; CEXPR( int , bound_answer , 100 ); FOR( i , 0 , Bd ){ if( found[i] ){ continue; } CONVERT1( i , P ); if( !coprime ){ continue; } answer++; // if( answer > bound_answer ){ // cout << bound_answer; // RETURN( "+" ); // } CONVERT2( i , P ); FOR( j , 0 , Bd ){ CONVERT1( j , R ); if( !coprime ){ continue; } CONVERT2( j , R ); int& detR_inv = inv[R00]; found[ detR_inv * P00 * R00 % B * d + detR_inv * ( ( P00 - 1 ) * R01 + P01 ) % d ] = true; } } if( answer > bound_answer ){ cout << bound_answer; RETURN( "+" ); } RETURN( answer ); }