提出 #32559394


ソースコード 拡げる

#include <bits/stdc++.h>
using namespace std;

// #define DEBUG
#ifdef DEBUG
    #define FAST freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#else
    #define FAST ios::sync_with_stdio(0), cin.tie(0);
    #define endl '\n'
#endif

using ll = long long;
using db = double;
#define F first 
#define S second
#define pii pair<ll,ll> 
#define eb emplace_back
#define tcase ll t; cin >> t; while (t--)
#define For(a, b, c) for (ll a = b; a < c; a++)
#define Forr(a, b, c) for (ll a = b; a >= c; a--)
#define lowbit(x) (x & -x)
#define void inline void
#define _ << ' ' << 
const ll maxn = 105;
const ll mod = 1e9+7;

ll n, x, y, now;
map<ll,ll> mp;

void solve() {

    for (auto i:mp) {
        if (now == 0 && i.S > 0) cout << i.F << ' ';
        else if (now+i.S == 0) cout << i.F << endl;
        now += i.S;
    }

    return ;

}

int main() {
    FAST;

    cin >> n;
    For (i, 0, n) {
        cin >> x >> y;
        mp[x]++;
        mp[y]--;
    }
    solve();
    
    return 0;

}

提出情報

提出日時
問題 D - Union of Interval
ユーザ user1519
言語 C++ (GCC 9.2.1)
得点 400
コード長 1063 Byte
結果 AC
実行時間 167 ms
メモリ 16100 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 400 / 400
結果
AC × 2
AC × 24
セット名 テストケース
Sample sample_01.txt, sample_02.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, sample_01.txt, sample_02.txt
ケース名 結果 実行時間 メモリ
random_01.txt AC 120 ms 7640 KiB
random_02.txt AC 41 ms 6628 KiB
random_03.txt AC 121 ms 9000 KiB
random_04.txt AC 109 ms 8324 KiB
random_05.txt AC 118 ms 8664 KiB
random_06.txt AC 117 ms 9092 KiB
random_07.txt AC 94 ms 7008 KiB
random_08.txt AC 57 ms 7260 KiB
random_09.txt AC 120 ms 8828 KiB
random_10.txt AC 108 ms 9572 KiB
random_11.txt AC 46 ms 3624 KiB
random_12.txt AC 3 ms 3532 KiB
random_13.txt AC 86 ms 12908 KiB
random_14.txt AC 86 ms 12988 KiB
random_15.txt AC 51 ms 9736 KiB
random_16.txt AC 167 ms 16092 KiB
random_17.txt AC 153 ms 16100 KiB
random_18.txt AC 92 ms 16044 KiB
random_19.txt AC 163 ms 16036 KiB
random_20.txt AC 76 ms 9784 KiB
random_21.txt AC 59 ms 10696 KiB
random_22.txt AC 46 ms 8548 KiB
sample_01.txt AC 7 ms 3612 KiB
sample_02.txt AC 2 ms 3520 KiB