結果

問題 No.1006 Share an Integer
ユーザー kotamanegikotamanegi
提出日時 2020-03-06 21:28:30
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 435 ms / 2,000 ms
コード長 1,178 bytes
コンパイル時間 1,954 ms
コンパイル使用メモリ 165,200 KB
実行使用メモリ 69,816 KB
最終ジャッジ日時 2024-05-07 20:35:12
合計ジャッジ時間 7,839 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
19,716 KB
testcase_01 AC 87 ms
19,072 KB
testcase_02 AC 87 ms
19,072 KB
testcase_03 AC 85 ms
19,060 KB
testcase_04 AC 84 ms
19,200 KB
testcase_05 AC 94 ms
19,072 KB
testcase_06 AC 86 ms
19,200 KB
testcase_07 AC 95 ms
19,200 KB
testcase_08 AC 91 ms
19,072 KB
testcase_09 AC 92 ms
19,200 KB
testcase_10 AC 88 ms
19,200 KB
testcase_11 AC 272 ms
68,200 KB
testcase_12 AC 414 ms
68,252 KB
testcase_13 AC 419 ms
68,956 KB
testcase_14 AC 423 ms
69,520 KB
testcase_15 AC 382 ms
69,272 KB
testcase_16 AC 209 ms
43,648 KB
testcase_17 AC 267 ms
68,208 KB
testcase_18 AC 372 ms
68,828 KB
testcase_19 AC 364 ms
68,560 KB
testcase_20 AC 408 ms
69,512 KB
testcase_21 AC 435 ms
69,816 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:2:18: warning: '#pragma comment linker' ignored [-Wignored-pragmas]
    2 | #pragma comment (linker, "/STACK:526000000")
      |                  ^
1 warning generated.

ソースコード

diff #

#define  _CRT_SECURE_NO_WARNINGS
#pragma comment (linker, "/STACK:526000000")

#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144 * 4LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}

#define int ll
int d[3000000];
int f(int x) {
    return x - d[x];
}
void solve() {
    for (int i = 1; i <= 2e6; ++i) {
        for (int q = 1; q * i <= 2e6; ++q) {
            d[i * q]++;
        }
    }
    int x;
    cin >> x;
    vector<tuple<int, int, int>> inputs;
    REP(i, x-1) {
        inputs.push_back(make_tuple((long long)abs(f(i + 1) - f(x - i - 1)), i + 1,x - i - 1));
    }
    sort(ALL(inputs));
    REP(i, inputs.size()) {
        if (get<0>(inputs[i]) != get<0>(inputs[0])) break;
        cout << get<1>(inputs[i]) << " " << get<2>(inputs[i]) << endl;
    }
}

#undef int
int main() {
    init();

    solve();
}
0