| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 464027 | dxz05 | 로봇 (IOI13_robots) | C++14 | 3073 ms | 19844 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "robots.h"
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 3e2;
#define MP make_pair
int A, B, N, X[MAXN], Y[MAXN], W[MAXN], S[MAXN];
bool removed[MAXN];
bool check(int val){
// cout << val << endl;
fill(removed, removed + N, false);
for (int i = 0; i < A; i++){
vector<pair<int, int>> vec;
for (int j = 0; j < N; j++){
if (removed[j]) continue;
if (W[j] < X[i]) vec.emplace_back(S[j], j);
}
sort(vec.rbegin(), vec.rend());
// cout << "weak #" << i + 1 << ": ";
for (int j = 0; j < vec.size(); j++){
if (j >= val) break;
int ind = vec[j].second;
removed[ind] = true;
// cout << ind + 1 << ' ';
}
// cout << endl;
}
for (int i = B - 1; i >= 0; i--){
vector<pair<int, int>> vec;
for (int j = 0; j < N; j++){
if (removed[j]) continue;
if (S[j] < Y[i]) vec.emplace_back(S[j], j);
}
sort(vec.rbegin(), vec.rend());
//cout << "small #" << i + 1 << ": ";
for (int j = 0; j < vec.size(); j++){
if (j >= val) break;
int ind = vec[j].second;
removed[ind] = true;
//cout << ind + 1 << ' ';
}
// cout << endl;
}
for (int i = 0; i < N; i++){
if (!removed[i]) return false;
}
return true;
}
int putaway(int _A, int _B, int _N, int _X[], int _Y[], int _W[], int _S[]) {
A = _A, B = _B, N = _N;
for (int i = 0; i < A; i++) X[i] = _X[i];
for (int i = 0; i < B; i++) Y[i] = _Y[i];
for (int i = 0; i < N; i++) W[i] = _W[i], S[i] = _S[i];
sort(X, X + A);
sort(Y, Y + B);
int l = 1, r = N;
int ans = -1;
while (l <= r){
int mid = (l + r) >> 1;
if (check(mid)){
ans = mid;
r = mid - 1;
} else l = mid + 1;
}
return ans;
}
컴파일 시 표준 에러 (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... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
