| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 982891 | hyakup | 로봇 (IOI13_robots) | C++17 | 3033 ms | 11112 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "robots.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int inf = 2e9 + 10;
vector<int> wbots, sbots;
struct Toy{
int w, s; Toy( int w, int s ): w(w), s(s) {}
bool operator < ( Toy t ){ return (( s == t.s ) ? w > t.w : s > t.s ); }
}; vector<Toy> toys;
bool check( int k ){
multiset<pair<int, int>> s;
for( int x : wbots ) s.insert({ x - 1, k });
ll cont = 0;
int i = 0;
for( Toy cur : toys ){
for( i; i < sbots.size() && sbots[i] > cur.s; i++ ) cont += k;
auto it = s.lower_bound({ cur.w, 0 });
if( it == s.end() ){
if( cont ){ cont--; continue; }
return false;
}
auto [val, qtd] = *it;
s.erase(it);
if( qtd > 1 ) s.insert({ val, qtd - 1 });
}
return true;
}
int bs(){
int t = toys.size(), b = wbots.size() + sbots.size();
int l = (t + b - 1)/b, r = t + 1;
while( l < r ){
int mid = ( l + r )/2;
if( check(mid) ) r = mid;
else l = mid + 1;
}
return ( r == toys.size() + 1 ) ? -1 : r;
}
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
for( int i = 0; i < A; i++ ) wbots.push_back(X[i]);
for( int i = 0; i < B; i++ ) sbots.push_back(Y[i]);
for( int i = 0; i < T; i++ ) toys.push_back( Toy( W[i], S[i] ) );
sort( sbots.rbegin(), sbots.rend() );
sort( toys.begin(), toys.end() );
return bs();
}
컴파일 시 표준 에러 (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... | ||||
