Submission #491476

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
4914762021-12-02 16:04:17MondeusSplit the sequence (APIO14_sequence)C++17
71 / 100
2083 ms125032 KiB
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <set>
#include <cassert>
#include <algorithm>
using namespace std;
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("Ofast")
struct CHT
{
vector<int> a;
vector<long long> b;
vector<int> id;
bool cross(int i, int j, int k)
{
return (b[k] - b[i]) * (a[j] - a[i]) >= (b[j] - b[i]) * (a[k] - a[i]);
}
void add(long long A, long long B, long long ID)
{
a.push_back(A);
b.push_back(B);
id.push_back(ID);
while(a.size() > 2 && cross(a.size()-3,a.size()-2,a.size()-1))
{
a.erase(a.end()-2);
b.erase(b.end()-2);
id.erase(id.end()-2);
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...