AtCoder Beginner Contest 014

Submission #1587294

Source codeソースコード

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const int inf = 1e9;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    const ll m = 2e6;
    ll n; cin >> n;
    vector<ll> cnt(m, 0);
    rep(i, n) {
        ll a, b; cin >> a >> b;
        cnt[a]++;
        cnt[b+1]--;
    }
    rep(i, m-1) cnt[i+1] += cnt[i];
    ll ans = 0;
    rep(i, m) chmax(ans, cnt[i]);
    cout << ans << endl;
}

Submission

Task問題 C - AtColor
User nameユーザ名 drafear
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 100
Source lengthソースコード長 1603 Byte
File nameファイル名
Exec time実行時間 28 ms
Memory usageメモリ使用量 15872 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - subtask0_sample01.txt,subtask0_sample02.txt
Subtask1 30 / 30 subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask0_sample01.txt,subtask0_sample02.txt
Subtask2 70 / 70 subtask0_sample01.txt,subtask0_sample02.txt,subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask2_01.txt,subtask2_02.txt,subtask2_03.txt,subtask2_04.txt,subtask2_05.txt,subtask2_06.txt,subtask2_07.txt,subtask2_08.txt,subtask2_09.txt,subtask2_10.txt,subtask2_11.txt,subtask2_12.txt,subtask2_13.txt,subtask2_14.txt,subtask2_15.txt,subtask2_16.txt,subtask2_17.txt,subtask2_18.txt,subtask2_19.txt,subtask2_20.txt,subtask2_21.txt,subtask2_22.txt,subtask2_23.txt,subtask2_24.txt,subtask2_25.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
subtask0_sample01.txt AC 8 ms 15872 KB
subtask0_sample02.txt AC 8 ms 15872 KB
subtask1_01.txt AC 8 ms 15872 KB
subtask1_02.txt AC 9 ms 15872 KB
subtask1_03.txt AC 8 ms 15872 KB
subtask1_04.txt AC 9 ms 15872 KB
subtask1_05.txt AC 8 ms 15872 KB
subtask1_06.txt AC 9 ms 15872 KB
subtask1_07.txt AC 9 ms 15872 KB
subtask1_08.txt AC 9 ms 15872 KB
subtask1_09.txt AC 8 ms 15872 KB
subtask1_10.txt AC 9 ms 15872 KB
subtask1_11.txt AC 9 ms 15872 KB
subtask1_12.txt AC 8 ms 15872 KB
subtask1_13.txt AC 8 ms 15872 KB
subtask1_14.txt AC 8 ms 15872 KB
subtask1_15.txt AC 9 ms 15872 KB
subtask2_01.txt AC 23 ms 15872 KB
subtask2_02.txt AC 24 ms 15872 KB
subtask2_03.txt AC 21 ms 15872 KB
subtask2_04.txt AC 23 ms 15872 KB
subtask2_05.txt AC 22 ms 15872 KB
subtask2_06.txt AC 25 ms 15872 KB
subtask2_07.txt AC 25 ms 15872 KB
subtask2_08.txt AC 25 ms 15872 KB
subtask2_09.txt AC 25 ms 15872 KB
subtask2_10.txt AC 26 ms 15872 KB
subtask2_11.txt AC 25 ms 15872 KB
subtask2_12.txt AC 26 ms 15872 KB
subtask2_13.txt AC 25 ms 15872 KB
subtask2_14.txt AC 25 ms 15872 KB
subtask2_15.txt AC 25 ms 15872 KB
subtask2_16.txt AC 25 ms 15872 KB
subtask2_17.txt AC 25 ms 15872 KB
subtask2_18.txt AC 28 ms 15872 KB
subtask2_19.txt AC 25 ms 15872 KB
subtask2_20.txt AC 25 ms 15872 KB
subtask2_21.txt AC 26 ms 15872 KB
subtask2_22.txt AC 25 ms 15872 KB
subtask2_23.txt AC 25 ms 15872 KB
subtask2_24.txt AC 25 ms 15872 KB
subtask2_25.txt AC 25 ms 15872 KB