제출 #1068839

#제출 시각아이디문제언어결과실행 시간메모리
1068839vjudge1Text editor (CEOI24_editor)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> #define div / #define ll long long #define fore(i, l, r) for(int i=int(l); i<int(r); i++) #define sz(a) int((a).size()) using namespace std; const int INF = 1e9; const int MX = 5e5 + 23; const int MOD = 1000000007; const int MAX_N = 5e5+23; const int N = 1e6; void solve() { int n; cin >> n; int sl,sc,el,ec; cin >> sl >> sc >> el >> ec; int l[n]; fore(i,0,n) cin >> l[i]; int ans = abs(sl-el) + abs(sc-ec); if(sl == 1) ans = min(ans,abs(2-el)+abs(1-ec)+1); if(sl == 2) { ans = min(ans,abs(1-el)+abs(l[0]-ec)+1); } else ans=min(ans,abs(1-el)+abs(l[0]-ec)+2); cout << ans << endl; } int main() { ios::sync_with_stdio(false); int t=1; while(t--) 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...