제출 #1073370

#제출 시각아이디문제언어결과실행 시간메모리
1073370ProtonDecay314Text editor (CEOI24_editor)C++17
5 / 100
1 ms348 KiB
#include<bits/stdc++.h> using namespace std; typedef int ll; // ! CAREFUL typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<ll, ll> pll; typedef vector<pll> vpll; typedef pair<int, int> pi; typedef vector<bool> vb; #define fi first #define se second #define IOS cin.tie(nullptr); cout.tie(nullptr); ios_base::sync_with_stdio(false) #define pb push_back ll solve(ll n, ll sl, ll sc, ll el, ll ec, const vll& l) { if(sl == 1 && el == 0) { return min(ec + 1, l[0] - ec); } else if(sl == 1 && el == 1) { return 0; } else if(el == 1) { return 1; } else { return min(ec + 2, min(l[0] - ec - 1 + 2, abs(ec - sc))); } } int main() { IOS; ll n; cin >> n; ll sl, sc; ll el, ec; cin >> sl >> sc; cin >> el >> ec; sl--; sc--; el--; ec--; vll l(n, 0); for(ll& lv : l) { cin >> lv; lv++; // ! WARNING, already added one } cout << solve(n, sl, sc, el, ec, l) << endl; return 0; }
#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...