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>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
struct button{
int A, T;
bool operator<(button &x){
return T < x.T;
}
};
int main(){
int N, M;
cin >> N >> M;
vector<button> arr(M);
for(int i = 0; i < M; i ++){
cin >> arr[i].T;
}
for(int j = 0; j < M; j ++){
cin >> arr[j].A;
}
sort(arr.begin(), arr.end());
int s = arr[0].A, t = arr[0].T;
for(int i = 0; i < M; i ++){
if(arr[i].T-t < abs(arr[i].A-s)){
cout << 2 << endl;
return 0;
}
t = arr[i].T;
s = arr[i].A;
}
cout << 1 << endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |