| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1342803 | valerian | Text editor (CEOI24_editor) | C++20 | 0 ms | 344 KiB |
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define endl '\n'
#define Valerian void
#define Valerian_or_Habil ios::sync_with_stdio(false); cin.tie(0);
using namespace std;
Valerian solve(){
ll n;
cin >> n;
ll sl, sc, el, ec;
cin >> sl >> sc >> el >> ec;
vector<ll> l(n + 1);
for(int i = 1; i <= n; i++) cin >> l[i];
if(sl == el){
cout << abs(sc - ec) << endl;
}
else{
ll res1 = 1 + abs(min(sc, l[el] + 1) - ec);
ll res2;
if(sl < el){
res2 = (l[sl] + 1 - sc) + 1 + (ec - 1);
} else {
res2 = (sc - 1) + 1 + (l[el] + 1 - ec);
}
cout << min(res1, res2) << endl;
}
}
int main(){
Valerian_or_Habil;
solve();
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... | ||||
