Submission #781161

#TimeUsernameProblemLanguageResultExecution timeMemory
781161caganyanmazRobots (IOI13_robots)C++17
14 / 100
145 ms12216 KiB
#include <bits/stdc++.h>
using namespace std;
#include "robots.h"

//#define DEBUGGING

void __print(size_t i) { std::cerr << i; }
void __print(int i) { std::cerr << i; }
void __print(long long int i) { std::cerr << i; }
void __print(const char *c) { std::cerr << c; }

template<typename T>
void __print(T& t) { std::cerr <<"{";int f = 0; for (auto& i : t) { std::cerr << ((f++) ? ", ": ""); __print(i); } std::cerr << "}"; }
void _print() { std::cerr << "]\n"; }
template<typename T, typename... V>
void _print(T t, V... v) { __print(t); if (sizeof...(v)) std::cerr << ", "; _print(v...); }


#ifdef DEBUGGING
#define debug(x...) std::cerr << "[" << (#x) << "] = ["; _print(x)
#else
#define debug(x...)
#endif



int ceil_div(int a, int b)
{
        debug(a, b);
        return (a + b-1) / b;
}
constexpr static int ASIZE = 50000;
int acount[ASIZE];

int putaway(int a, int b, int t, int x[], int y[], int w[], int s[])
{
        if (b == 0)
        {
                sort(x, x + a);
                for (int i = 0; i < t; i++)
                {
                        int index = upper_bound(x, x + a, w[i]) - x;
                        if (w[i] >= x[index])
                                return -1;
                        acount[index]++;
                }
                int prefix = 0;
                int cost = 0;
                for (int i = a-1; i >= 0; i--)
                {
                        prefix += acount[i];
                        cost = max(cost, ceil_div(prefix, a - i));
                }
                return cost;
        }
        return -1;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...