結果

問題 No.610 区間賞(Section Award)
ユーザー Konton7
提出日時 2020-02-08 13:35:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,189 bytes
コンパイル時間 3,070 ms
コンパイル使用メモリ 205,472 KB
最終ジャッジ日時 2025-01-08 22:59:20
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 8 WA * 42
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using PII = std::pair<int, int>;
using PLL = std::pair<ll, ll>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)




int main()
{

#ifdef DEBUG
    cout << "DEBUG MODE" << endl;
    ifstream in("input.txt"); //for debug
    cin.rdbuf(in.rdbuf());    //for debug
#endif

    int n, x, s, maxorder;
    cin >> n;
    int runid[n];
    int runners[n][2];
    vector<PII> run;
    vector<int> candidate, candidate2;

    rep(i, n)
    {
        cin >> x;
        runners[i][1] = x;
        runid[i] = x;
    }
    rep(i, n)
    {
        cin >> x;
        runners[i][0] = x;
        run.push_back(make_pair(runners[i][0], runners[i][1]));
    }

    sort(run.rbegin(),run.rend());

    maxorder = n + 1;
    for (auto z : run)
    {
        if (z.second < maxorder)
        {
            maxorder = z.second;
            candidate.push_back(z.first);
        }
    }

    for (auto z : candidate)
        candidate2.push_back(runid[z-1]);

    sort(candidate2.begin(), candidate2.end());
    for (auto z : candidate2)
        cout << z << endl;
    return 0;
}
0