| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 105324 | eriksuenderhauf | Jousting tournament (IOI12_tournament) | C++11 | 213 ms | 9092 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
//#include "grader.h"
#define pii pair<int, int>
#define pll pair<long long, long long>
#define vii vector<pii>
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long int ll;
const int MAXN = 2e5 + 5;
int n, BIT[MAXN], sm[MAXN], cnt[MAXN];
set<int> act;
int sum(int ind) {
ind++;
int ret = 0;
while (ind > 0) {
ret += BIT[ind];
ind -= ind & -ind;
}
return ret;
}
void upd(int ind, int val) {
ind++;
while (ind <= n) {
BIT[ind] += val;
ind += ind & -ind;
}
}
int qry(int val) {
int lo = 0, hi = n - 1, ret = -1;
while (lo <= hi) {
int mi = (lo + hi) / 2;
if (sum(mi) <= val)
ret = mi, lo = mi + 1;
else
hi = mi - 1;
}
return ret;
}
int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) {
n = N;
for (int i = 0; i < n; i++) {
sm[i] = sm[i - 1];
if (i < n - 1 && K[i] > R)
sm[i]++;
}
for (int i = 0; i < n; i++) {
upd(i, 1);
act.insert(i);
}
for (int i = 0; i < C; i++) {
int l = qry(S[i]) + 1, r = qry(E[i] + 1);
vi tmp;
for (auto it = act.find(l); it != act.end() && *it <= r; it++)
tmp.pb(*it);
for (int j = 0; j < tmp.size(); j++) {
upd(tmp[j], -1);
act.erase(tmp[j]);
}
upd(l, 1);
act.insert(l);
if (sm[l - 1] == sm[r - 1])
cnt[l]++, cnt[r + 1]--;
}
pii ret = {0, 0};
for (int i = 0; i < n; i++) {
cnt[i] += cnt[i - 1];
ret = max(ret, {cnt[i], -i});
}
return -ret.se;
}컴파일 시 표준 에러 (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... | ||||
