結果

問題 No.3054 Modulo Inequalities
ユーザー suisen
提出日時 2025-01-18 16:24:52
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 945 bytes
コンパイル時間 1,146 ms
コンパイル使用メモリ 93,224 KB
実行使用メモリ 7,236 KB
最終ジャッジ日時 2025-02-02 13:31:14
合計ジャッジ時間 50,052 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

// WA

#include <cmath>
#include <chrono>
#include <iostream>
#include <vector>

constexpr int M = 1000010;

int main() {
    auto start = std::chrono::system_clock::now();

    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int n;
    std::cin >> n;
    std::vector<std::pair<int, int>> ps(n);
    for (auto &[a, b] : ps) {
        std::cin >> a >> b;
    }

    int max_num = -1;
    int argmax = -1;
    for (int mod = 1; mod <= M; ++mod) {
        int num = 0;
        for (const auto &[a, b] : ps) {
            num += (a % mod) < (b % mod);
        }
        if (num > max_num) {
            max_num = num;
            argmax = mod;
        }
        if ((mod & 31) == 0) {
            auto now = std::chrono::system_clock::now();
            if (std::chrono::duration_cast<std::chrono::milliseconds>(now - start).count() > 1900) {
                break;
            }
        }
    }
    std::cout << argmax << '\n';
}
0