結果

問題 No.1058 素敵な数
ユーザー sahiyasahiya
提出日時 2021-03-02 17:13:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,256 bytes
コンパイル時間 1,747 ms
コンパイル使用メモリ 119,228 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-27 03:42:02
合計ジャッジ時間 1,888 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#include <algorithm>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstring>
#include <deque>
#include <forward_list>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef bitset<16> BS;

const ll MOD = 1E+09 + 7;
const ll INF = 1E15;
const int MAX_N = 1E+05;

int N;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    cin >> N;

    vector<ll> prm = { 100003, 100019, 100043, 100049, 100057, 100069, 100103,
        100109, 100129, 100151 };

    vector<ll> res = { 1 };

    for (int i = 0; i < prm.size(); i++) {
        for (int j = i; j < prm.size(); j++) {
            res.push_back(prm[i] * prm[j]);
        }
    }

    sort(res.begin(), res.end());

    /*
    for (int i = 0; i < N; i++) {
        for (int j = 0; j < N; j++) {
            cout << "i = " << i << ", j = " << j << ", dp = " << dp[i][j] << "\n";
        }
    }
    */

    cout << res[N - 1] << "\n";

    return 0;
}
0