提出 #53601590


ソースコード 拡げる

// #pragma GCC optimize("Ofast,unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf (ll)1e18
#define pll pair<ll, ll>
#define vi vector<int>
#define vl vector<ll>
#define fi first
#define se second
#define lll __int128
const int N = 1e6 + 5;

void solve() {
    ll n;
    cin >> n;
    vector<array<ll, 3>> v(n + 1);
    for (ll i = 1; i <= n; i++) {
        for (ll j = 0; j < 2; j++)
            cin >> v[i][j];
        v[i][2] = i;
    }
    sort(v.begin() + 1, v.end(), greater());
    vl ans;
    ans.push_back(v[1][2]);
    for (ll i = 2, mx = v[1][1]; i <= n; i++) {
        auto [a, c, j] = v[i];
        if (c < mx)
            ans.push_back(j);
        mx = min(mx, c);
    }
    cout << ans.size() << endl;
    sort(ans.begin(), ans.end());
    for (ll x : ans)
        cout << x << " ";
    cout << endl;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}

提出情報

提出日時
問題 C - AtCoder Magics
ユーザ TopCloser
言語 C++ 20 (gcc 12.2)
得点 350
コード長 1015 Byte
結果 AC
実行時間 37 ms
メモリ 9880 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 350 / 350
結果
AC × 3
AC × 17
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_hand_00.txt, 01_hand_01.txt, 01_hand_02.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 1 ms 3528 KiB
00_sample_01.txt AC 1 ms 3384 KiB
00_sample_02.txt AC 1 ms 3424 KiB
01_hand_00.txt AC 25 ms 7760 KiB
01_hand_01.txt AC 37 ms 9880 KiB
01_hand_02.txt AC 27 ms 8824 KiB
02_random_00.txt AC 25 ms 7760 KiB
02_random_01.txt AC 25 ms 7896 KiB
02_random_02.txt AC 24 ms 7732 KiB
02_random_03.txt AC 25 ms 7760 KiB
02_random_04.txt AC 25 ms 7892 KiB
02_random_05.txt AC 25 ms 7752 KiB
02_random_06.txt AC 25 ms 7732 KiB
02_random_07.txt AC 25 ms 7796 KiB
02_random_08.txt AC 26 ms 7740 KiB
02_random_09.txt AC 25 ms 7804 KiB
02_random_10.txt AC 25 ms 7836 KiB