結果

問題 No.1006 Share an Integer
ユーザー kotamanegikotamanegi
提出日時 2020-03-06 21:28:30
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
AC  
実行時間 538 ms / 2,000 ms
コード長 1,178 bytes
コンパイル時間 2,313 ms
コンパイル使用メモリ 136,720 KB
実行使用メモリ 70,836 KB
最終ジャッジ日時 2023-08-20 14:06:40
合計ジャッジ時間 9,772 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
19,760 KB
testcase_01 AC 127 ms
20,436 KB
testcase_02 AC 130 ms
20,472 KB
testcase_03 AC 124 ms
19,428 KB
testcase_04 AC 124 ms
19,448 KB
testcase_05 AC 127 ms
20,196 KB
testcase_06 AC 125 ms
20,624 KB
testcase_07 AC 126 ms
20,836 KB
testcase_08 AC 127 ms
19,880 KB
testcase_09 AC 127 ms
19,372 KB
testcase_10 AC 133 ms
21,044 KB
testcase_11 AC 362 ms
70,836 KB
testcase_12 AC 521 ms
69,024 KB
testcase_13 AC 530 ms
68,896 KB
testcase_14 AC 538 ms
68,780 KB
testcase_15 AC 478 ms
69,272 KB
testcase_16 AC 278 ms
44,208 KB
testcase_17 AC 356 ms
70,400 KB
testcase_18 AC 467 ms
69,828 KB
testcase_19 AC 473 ms
70,104 KB
testcase_20 AC 510 ms
69,612 KB
testcase_21 AC 534 ms
70,116 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:2:18: warning: '#pragma comment linker' ignored [-Wignored-pragmas]
#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