結果

問題 No.2191 一元二次式 mod 奇素数
ユーザー MasKoaTSMasKoaTS
提出日時 2022-11-17 13:59:45
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 477 bytes
コンパイル時間 660 ms
コンパイル使用メモリ 30,332 KB
実行使用メモリ 5,092 KB
最終ジャッジ日時 2023-10-19 06:10:04
合計ジャッジ時間 7,746 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,968 KB
testcase_01 AC 1 ms
5,044 KB
testcase_02 AC 1 ms
4,972 KB
testcase_03 AC 1 ms
5,028 KB
testcase_04 AC 1 ms
5,028 KB
testcase_05 AC 1 ms
4,972 KB
testcase_06 AC 1 ms
5,028 KB
testcase_07 AC 1 ms
4,988 KB
testcase_08 AC 1 ms
5,028 KB
testcase_09 AC 1 ms
4,972 KB
testcase_10 AC 1 ms
4,968 KB
testcase_11 AC 1 ms
4,972 KB
testcase_12 AC 1 ms
4,988 KB
testcase_13 AC 1 ms
5,028 KB
testcase_14 AC 1 ms
4,972 KB
testcase_15 AC 1 ms
4,972 KB
testcase_16 AC 1 ms
4,972 KB
testcase_17 AC 1 ms
5,028 KB
testcase_18 AC 1 ms
5,028 KB
testcase_19 AC 1 ms
5,044 KB
testcase_20 AC 1 ms
4,988 KB
testcase_21 AC 3 ms
4,972 KB
testcase_22 AC 269 ms
5,028 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

// 愚直解

#include <stdio.h>
#define ll long long
#define abs(x) ((x) < 0 ? -(x) : (x))

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable: 4996)


int main(void) {
	ll p;	scanf("%lld", &p);
	ll K = (p - 1) >> 1;
	ll t = -4 * K * K - 16 * K + 1;
	ll a = p - abs(t) % p;

	for (ll x = 1; x <= K; ++x) {
		if (a != x * x % p) {
			continue;
		}
		printf("YES\n");
		return 0;
	}
	printf("NO\n");

	return 0;
}
0