Submission #33432058
Source Code Expand
#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));
}
Submission Info
| Submission Time | |
|---|---|
| Task | A - Intersection |
| User | aoken_7 |
| Language | C++ (GCC 9.2.1) |
| Score | 100 |
| Code Size | 524 Byte |
| Status | AC |
| Exec Time | 6 ms |
| Memory | 3612 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 100 / 100 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| 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 |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 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 |