# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1058990 | oscarsierra12 | Robots (IOI13_robots) | C++14 | 156 ms | 65536 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;
typedef pair<int, int> ii;
typedef long long ll;
typedef pair<long long, long long> pll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
#define pb push_back
#define fi first
#define se second
#define whole(v) v.begin(), v.end()
#define rwhole(v) v.rbegin(), v.rend()
#define inf INT_MAX/2
#define fro front
bool cmp(vi a, vi b) {
return a.size() < b.size();
}
int putaway(int a, int b, int t, int x[], int y[], int w[], int s[]){
vector<vi> n(a + b);
int mem[t];
memset(mem, -1, sizeof mem);
for(int i = 0; i < a; ++i){
int k = x[i];
for(int j = 0; j < t; ++j){
if(w[j] < k){
n[i].pb(j);
mem[j] = 1;
}
}
}
for(int i = 0; i < b; ++i){
int k = y[i];
for(int j = 0; j < t; ++j){
if(s[j] < k){
n[a + i].pb(j);
mem[j] = 1;
}
}
}
sort(whole(n), cmp);
for(auto e:mem){
if(e == -1){
return -1;
}
}
int ans = 0;
int cnt = 0;
int pos[n.size()];
memset(pos, 0, sizeof pos);
while(cnt < t){
for(int i = 0; i < n.size(); ++i){
if(pos[i] >= n[i].size()){
continue;
}
if(mem[n[i][pos[i]]] == 10){
pos[i]++;
if(pos[i] >= n[i].size()){
pos[i] = 1000000000;
++i;
}
i--;
continue;
}else{
mem[n[i][pos[i]]] = 10;
cnt++;
pos[i]++;
if(pos[i] >= n[i].size()){
pos[i] = 1000000000;
++i;
}
}
}
ans++;
}
return ans;
}
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... |