| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1053867 | VMaksimoski008 | 케이크 (CEOI14_cake) | C++17 | 2074 ms | 4756 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
//#define int long long
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int mod = 1e9 + 7;
const int LOG = 20;
const int maxn = 3e5 + 5;
struct SegTree {
};
signed main() {
ios_base::sync_with_stdio(false);
cout.tie(0); cin.tie(0);
int n, s, q;
cin >> n >> s;
vector<ll> v(n+1), v2;
for(int i=1; i<=n; i++) cin >> v[i], v[i] *= (ll)1e6;
for(int i=1; i<=n; i++) v2.push_back(i);
sort(v2.begin(), v2.end(), [&](int a, int b) {
return v[a] > v[b];
});
while(v2.size() > 10) v2.pop_back();
cin >> q;
while(q--) {
char t;
cin >> t;
if(t == 'F') {
int p;
cin >> p;
if(p == s) {
cout << 0 << '\n';
continue;
}
int l=s, r=s, ans=0;
while(l != p && r != p) {
ans++;
if(l - 1 == 0) r++;
else if(r + 1 > n) l--;
else if(v[l-1] < v[r+1]) l--;
else r++;
}
cout << ans << '\n';
} else {
int a, b;
cin >> a >> b;
v[a] = v[v2[b-1]] + 1;
//check if its almost in top 10
bool ok = 0;
for(int i=0; i<v2.size()&&!ok; i++)
if(v2[i] == a) ok = 1;
if(!ok) v2.push_back(a);
sort(v2.begin(), v2.end(), [&](int a, int b) {
return v[a] > v[b];
});
if(!ok) v2.pop_back();
}
}
return 0;
}컴파일 시 표준 에러 (stderr) 메시지
| # | 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... | ||||
