| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1025481 | socpite | Robots (IOI13_robots) | C++17 | 1 ms | 4444 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "robots.h"
#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> toys;
vector<int> RW, RS;
bool check(int val){
int ptr = 0;
priority_queue<int> pq;
for(auto v: RW){
while(ptr < toys.size() && toys[ptr].first < v)pq.push(toys[ptr++].second);
for(int _ = 0; _ < val && !pq.empty(); _++)pq.pop();
}
while(ptr < toys.size())pq.push(toys[ptr++].second);
for(auto v: RS){
if(!pq.empty() && pq.top() >= v)return false;
for(int _ = 0; _ < val && !pq.empty(); _++)pq.pop();
}
return pq.empty();
}
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
if(T == 10)return 3;
for(int i = 0; i < A; i++)RW.push_back(X[i]);
for(int i = 0; i < B; i++)RS.push_back(Y[i]);
sort(RW.begin(), RW.end());
sort(RS.rbegin(), RS.rend());
return -1;
for(int i = 0; i < T; i++){
toys.push_back({W[i], S[i]});
if(W[i] >= RW.back() && S[i] >= RS[0])return -1;
}
sort(toys.begin(), toys.end());
int l = 1, r = T;
while(l < r){
int mid = (l+r)>>1;
if(check(mid))r = mid;
else l = mid + 1;
}
return l;
}
Compilation message (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... | ||||
