This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
using namespace std;
int main(){
int N;
int s1[11], e1[11], s2[11], e2[11];
int i;
int flag[11];
int check = 0;
int result = 0;
cin >> N;
for (i = 0; i < N; i++){
cin >> s1[i] >> e1[i];
}
for (i = 0; i < N; i++){
cin >> s2[i] >> e2[i];
}
for (i = 0; i < N; i++){
if (e1[i] < s2[i]){
flag[i] = 0;
check = 1;
}
else if (e1[i] == s2[i]){
flag[i] = 1;
result += flag[i];
}
else{
if (s2[i] >= s1[i]){
flag[i] = 2;
result += flag[i];
}
else{
if (s1[i] > e2[i]){
flag[i] = 0;
check = 1;
}
else if (s1[i] == e2[i]){
flag[i] = 1;
result += flag[i];
}
else{
flag[i] = 2;
result += flag[i];
}
}
}
}
if (check == 1)
cout << -1;
else
cout << result - N;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |