Submission #1068747

#TimeUsernameProblemLanguageResultExecution timeMemory
1068747AlebnText editor (CEOI24_editor)C++14
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> #define int long long using namespace std; void solve() { int n, sl, sc, el, ec; cin >> n >> sl >> sc >> el >> ec; sl--, sc--, el--, ec--; vector<int> l(n); for(int i = 0; i < n; i++) cin >> l[i]; if(sl <= el) cout << abs(sl - el) + min(abs(sc - ec), min((sl == n - 1 ? INT_MAX : l[0] - sc + ec), (sl == 0 ? INT_MAX : sc + 2 + l[0] - ec))) << "\n"; else cout << abs(sl - el) + min(abs(sc - ec), min((sl == n - 1 ? INT_MAX : l[0] - sc + ec + 1), (sl == 0 ? INT_MAX : sc + 1 + l[0] - ec))) << "\n"; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...