# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
960758 | ThegeekKnight16 | Aliens (IOI16_aliens) | C++17 | 1 ms | 500 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 <bits/stdc++.h>
#include "aliens.h"
using namespace std;
typedef long long ll;
vector<ll> A, B, ids; int tam = 0, pos = 0;
bool inutil(int novo, int atual, int velho)
{
return ((B[velho] - B[novo])*(A[atual] - A[velho]) <= (B[velho] - B[atual])*(A[novo] - A[velho]));
}
void update(ll newA, ll newB, ll newId)
{
A.push_back(newA); B.push_back(newB); ids.push_back(newId);
++tam;
while (tam > 2 && inutil(tam-1, tam-2, tam-3)) {A.erase(A.end()-2); B.erase(B.end()-2); ids.erase(ids.end()-2); --tam;}
}
pair<ll, ll> query(ll x)
{
if (pos >= tam) pos = tam-1;
while (pos < tam-1 && (A[pos]*x + B[pos]) >= (A[pos+1]*x + B[pos+1])) ++pos;
return make_pair(A[pos]*x + B[pos], ids[pos]);
}
ll take_photos(int N, int M, int K, std::vector<int> r, std::vector<int> c)
{
vector<pair<ll, ll>> v(N);
for (int i = 0; i < N; i++)
{
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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |