Submission #22001194
Source Code Expand
/** author: samari06, created: 24.04.2021 21:02:00 **/
#include <bits/stdc++.h>
#define REP(i, N) for(int i = 0; i < (int)N; i++)
using namespace std;
typedef long long ll;
int main(){
int n;
cin >> n;
int u = 1001, d = 0;
vector<int> a(n), b(n);
REP(i,n){
scanf("%d", &a[i]);
}
REP(i,n){
scanf("%d", &b[i]);
}
REP(i,n){
if(a[i] > d) d = a[i];
if(b[i] < u) u = b[i];
}
int res = u-d+1;
if(res < 0) res = 0;
cout << res;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Intersection |
| User | samari06 |
| Language | C++ (GCC 9.2.1) |
| Score | 200 |
| Code Size | 554 Byte |
| Status | AC |
| Exec Time | 8 ms |
| Memory | 3668 KiB |
Compile Error
./Main.cpp: In function ‘int main()’:
./Main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
14 | scanf("%d", &a[i]);
| ~~~~~^~~~~~~~~~~~~
./Main.cpp:17:14: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
17 | scanf("%d", &b[i]);
| ~~~~~^~~~~~~~~~~~~
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | extreme_00.txt, extreme_01.txt, extreme_02.txt, manual_00.txt, manual_01.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, sample_01.txt, sample_02.txt, sample_03.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| extreme_00.txt | AC | 8 ms | 3648 KiB |
| extreme_01.txt | AC | 2 ms | 3572 KiB |
| extreme_02.txt | AC | 2 ms | 3540 KiB |
| manual_00.txt | AC | 8 ms | 3664 KiB |
| manual_01.txt | AC | 3 ms | 3592 KiB |
| random_00.txt | AC | 2 ms | 3592 KiB |
| random_01.txt | AC | 3 ms | 3644 KiB |
| random_02.txt | AC | 3 ms | 3496 KiB |
| random_03.txt | AC | 5 ms | 3628 KiB |
| random_04.txt | AC | 3 ms | 3576 KiB |
| random_05.txt | AC | 2 ms | 3592 KiB |
| random_06.txt | AC | 2 ms | 3496 KiB |
| random_07.txt | AC | 2 ms | 3668 KiB |
| sample_01.txt | AC | 3 ms | 3592 KiB |
| sample_02.txt | AC | 3 ms | 3668 KiB |
| sample_03.txt | AC | 3 ms | 3592 KiB |