結果
問題 | No.1396 Giri |
ユーザー | sekiye |
提出日時 | 2021-02-14 21:50:17 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 206 ms / 2,000 ms |
コード長 | 2,281 bytes |
コンパイル時間 | 2,078 ms |
コンパイル使用メモリ | 201,748 KB |
実行使用メモリ | 11,284 KB |
最終ジャッジ日時 | 2023-09-29 15:09:46 |
合計ジャッジ時間 | 4,277 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,380 KB |
testcase_02 | AC | 203 ms
11,164 KB |
testcase_03 | AC | 1 ms
4,380 KB |
testcase_04 | AC | 1 ms
4,384 KB |
testcase_05 | AC | 200 ms
11,212 KB |
testcase_06 | AC | 1 ms
4,380 KB |
testcase_07 | AC | 1 ms
4,380 KB |
testcase_08 | AC | 1 ms
4,384 KB |
testcase_09 | AC | 1 ms
4,376 KB |
testcase_10 | AC | 1 ms
4,380 KB |
testcase_11 | AC | 1 ms
4,384 KB |
testcase_12 | AC | 1 ms
4,376 KB |
testcase_13 | AC | 2 ms
4,380 KB |
testcase_14 | AC | 1 ms
4,376 KB |
testcase_15 | AC | 1 ms
4,380 KB |
testcase_16 | AC | 1 ms
4,380 KB |
testcase_17 | AC | 3 ms
4,380 KB |
testcase_18 | AC | 10 ms
4,384 KB |
testcase_19 | AC | 87 ms
9,484 KB |
testcase_20 | AC | 131 ms
9,488 KB |
testcase_21 | AC | 178 ms
10,400 KB |
testcase_22 | AC | 203 ms
11,084 KB |
testcase_23 | AC | 203 ms
11,144 KB |
testcase_24 | AC | 206 ms
11,284 KB |
testcase_25 | AC | 202 ms
11,172 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned int uint; typedef unsigned long long ull; static const double EPS = 1e-12; static const double PI = acos(-1.0); template <class T> using V = vector<T>; template <class T> using VV = V<V<T>>; #define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define REP(i, n) for (int i = 0; i < (int)(n); i++) #define ALL(a) (a).begin(), (a).end() #ifdef LOCAL #define dbg(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl #else #define dbg(x) true #endif // auto mod int // https://youtu.be/L8grWxBlIZ4?t=9858 // https://youtu.be/ERZuLAxZffQ?t=4807 : optimize // https://youtu.be/8uowVvQ_-Mo?t=1329 : division const int mod = 998244353; struct mint { ll x; // typedef long long ll; mint(ll x = 0) : x((x % mod + mod) % mod) {} mint operator-() const { return mint(-x); } mint &operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; } mint &operator-=(const mint a) { if ((x += mod - a.x) >= mod) x -= mod; return *this; } mint &operator*=(const mint a) { (x *= a.x) %= mod; return *this; } mint operator+(const mint a) const { return mint(*this) += a; } mint operator-(const mint a) const { return mint(*this) -= a; } mint operator*(const mint a) const { return mint(*this) *= a; } mint pow(ll t) const { if (!t) return 1; mint a = pow(t >> 1); a *= a; if (t & 1) a *= *this; return a; } // for prime mod mint inv() const { return pow(mod - 2); } mint &operator/=(const mint a) { return *this *= a.inv(); } mint operator/(const mint a) const { return mint(*this) /= a; } }; istream &operator>>(istream &is, const mint &a) { return is >> a.x; } ostream &operator<<(ostream &os, const mint &a) { return os << a.x; } ll sieve[1'000'001]; int main() { int n; cin >> n; REP(i, n + 1) { sieve[i] = i; } FOR(i, 2, n + 1) { for (int j = 2 * i; j <= n; j += i) { if (sieve[j] % sieve[i] == 0) { sieve[j] /= sieve[i]; } } } sort(sieve, sieve + n + 1); mint ans = 1; REP(i, n) { if (sieve[i] > 1) { ans *= sieve[i]; } } cout << ans << endl; return 0; }