이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int ll
typedef long long ll;
using namespace std;
const int N = 2e5 + 10, mod = 1e9 + 7;
signed main()
{
FAST;
int n, a;
cin >> n >> a;
int arr[n+2];
arr[n + 1] = LLONG_MAX;
for(int i = 1; i <= n; i++) cin >> arr[i];
int q;
cin >> q;
while(q--) {
char t;
cin >> t;
if(t == 'F') {
int x;
cin >> x;
int cnt = 1;
if(a == x) cout << 0 << endl;
else {
int l = a - 1, r = a + 1;
bool flag = 1;
while(flag) {
cout << arr[l] << ' ' << arr[r] << endl;
if(l > 1 && arr[l] < arr[r]) l--;
else if(r <= n) r++;
else l--;
if(l < x && r > x) {
flag = 0;
break;
}
cnt++;
}
cout << cnt << endl;
}
}
else {
int x, y;
cin >> x >> y;
arr[x] += y;
}
}
}
# | 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... |