結果

問題 No.1255 ハイレーツ・オブ・ボリビアン
ユーザー 👑 NachiaNachia
提出日時 2020-10-09 22:24:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 571 bytes
コンパイル時間 1,450 ms
コンパイル使用メモリ 171,184 KB
実行使用メモリ 8,480 KB
最終ジャッジ日時 2023-09-27 18:05:49
合計ジャッジ時間 16,299 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 4 ms
4,380 KB
testcase_05 AC 180 ms
7,960 KB
testcase_06 AC 273 ms
7,924 KB
testcase_07 AC 190 ms
7,624 KB
testcase_08 AC 1,864 ms
7,916 KB
testcase_09 AC 1,879 ms
8,000 KB
testcase_10 AC 1,902 ms
8,480 KB
testcase_11 AC 1,877 ms
8,328 KB
testcase_12 AC 1,880 ms
7,776 KB
testcase_13 WA -
testcase_14 TLE -
testcase_15 AC 1,865 ms
7,764 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;
	ULL p = 1;
	rep(i, 100000) { X[p] = i; p = p * 2 % N; if (p == 1) return i + 1; }
	p = 1;
	ULL q = 1; rep(i, 100000) q = q * (N / 2 + 1) % N;
	rep(i, 100000) {
		p = p * q % N;
		if (X.count(p)) return (i + 1) * 100000 + X[p];
	}
}

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

	return 0;
}
0