結果

問題 No.1255 ハイレーツ・オブ・ボリビアン
ユーザー 👑 NachiaNachia
提出日時 2020-10-09 22:37:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 575 bytes
コンパイル時間 1,462 ms
コンパイル使用メモリ 172,228 KB
実行使用メモリ 5,072 KB
最終ジャッジ日時 2023-09-27 18:31:42
合計ジャッジ時間 6,165 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 4 ms
4,500 KB
testcase_03 AC 4 ms
4,380 KB
testcase_04 AC 4 ms
4,376 KB
testcase_05 AC 95 ms
4,744 KB
testcase_06 AC 124 ms
4,860 KB
testcase_07 AC 100 ms
4,904 KB
testcase_08 AC 455 ms
4,944 KB
testcase_09 AC 458 ms
5,008 KB
testcase_10 AC 455 ms
5,028 KB
testcase_11 AC 466 ms
4,908 KB
testcase_12 AC 473 ms
4,928 KB
testcase_13 WA -
testcase_14 AC 747 ms
5,032 KB
testcase_15 AC 465 ms
5,024 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘ULL loop(ULL)’ 内:
main.cpp:20:1: 警告: 制御が非 void 関数の終りに到達しました [-Wreturn-type]
   20 | }
      | ^

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
#define rep(i,n) for(int i=0; i<(n); i++)

#include<unordered_map>

ULL loop(ULL N) {
	N = 2 * N - 1;
	unordered_map<ULL, ULL> X(40000);
	ULL p = 1;
	rep(i, 40000) { X[p] = i; p = p * 2 % N; if (p == 1) return i + 1; }
	p = 1;
	ULL q = 1; rep(i, 40000) q = q * (N / 2 + 1) % N;
	rep(i, 100000) {
		p = p * q % N;
		if (X.count(p)) return (i + 1) * 40000 + X[p];
	}
}

int main() {
	int T; cin >> T;
	while (T--) {
		ULL N; cin >> N;
		cout << loop(N) << endl;
	}

	return 0;
}
0