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 <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
using tlii = tuple<ll, int, int>;
using tiii = tuple<int, int, int>;
int main()
{
std::ios::sync_with_stdio(false);
int N;
cin >> N;
int sl, sc, el, ec;
cin >> sl >> sc >> el >> ec;
vector<int> width(N+1, 0);
for (int i=1; i<=N; i++)
cin >> width[i];
if (N<=2)
{
if ((sl==el) and (sc==ec))
cout << "0\n";
else if (el==2)
cout << "1\n";
else if (sl==2)
cout << 1+min(ec-1, width[1]+1-ec) << '\n';
else
cout << min(abs(sc-ec), 2+min(ec-1, width[1]+1-ec)) << '\n';
}
}
# | 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... |