提出 #33432058


ソースコード 拡げる

#include <bits/stdc++.h>
#define all(a) a.begin(), a.end()
#define put(i) cout << i << endl
#define rep(i, s, n) for (long long i = s; i < (long long)(n); i++)
using namespace std;
using ll = long long;

int main() {
    ll l1, r1, l2, r2;
    cin >> l1 >> r1 >> l2 >> r2;

    vector<ll> a(101,0), b(101,0);
    for(ll i=l1; i<=r1; i++){
        a[i]++;
    }
    for(ll i=l2; i<=r2; i++){
        b[i]++;
    }

    ll ans = 0;
    rep(i,0,101){
        if (a[i] > 0 and b[i] > 0) ans++;
    }

    put(max(0LL,ans-1));
}

提出情報

提出日時
問題 A - Intersection
ユーザ aoken_7
言語 C++ (GCC 9.2.1)
得点 100
コード長 524 Byte
結果 AC
実行時間 6 ms
メモリ 3612 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 100 / 100
結果
AC × 3
AC × 11
セット名 テストケース
Sample example_00.txt, example_01.txt, example_02.txt
All example_00.txt, example_01.txt, example_02.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 6 ms 3608 KiB
example_01.txt AC 2 ms 3456 KiB
example_02.txt AC 2 ms 3504 KiB
hand_00.txt AC 2 ms 3612 KiB
hand_01.txt AC 2 ms 3504 KiB
hand_02.txt AC 2 ms 3608 KiB
hand_03.txt AC 2 ms 3420 KiB
hand_04.txt AC 4 ms 3392 KiB
hand_05.txt AC 1 ms 3452 KiB
hand_06.txt AC 2 ms 3420 KiB
hand_07.txt AC 2 ms 3400 KiB