Submission #1102041

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11020412024-10-17 10:38:09woohyun_jngSplit the sequence (APIO14_sequence)C++17
71 / 100
28 ms131072 KiB
#include <bits/stdc++.h>
#define int long long
#define MAX 100100
#define MAX_K 210
#define MOD 1000000007
#define INF 0x7f7f7f7f7f7f7f7f
#define endl '\n'
using namespace std;
typedef pair<int, int> pr;
typedef array<int, 3> tp;
typedef array<int, 4> ftp;
class ConvexHullTrick {
public:
vector<ftp> F;
int ftop = 0;
void insert(tp X) {
ftp K = {X[0], X[1], 0, X[2]};
while (!F.empty()) {
if (F.back()[0] == K[0]) {
if (F.back()[1] >= K[1])
return;
} else {
K[2] = (F.back()[1] - K[1]) / (K[0] - F.back()[0]);
if (F.back()[2] < K[2])
break;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

sequence.cpp: In member function 'void ConvexHullTrick::insert(tp)':
sequence.cpp:32:26: warning: comparison of integer expressions of different signedness: 'std::vector<std::array<long long int, 4> >::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   32 |             if (F.size() == ftop)
      |                 ~~~~~~~~~^~~~~~~
sequence.cpp: In member function 'tp ConvexHullTrick::query(long long int)':
sequence.cpp:39:25: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::array<long long int, 4> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         while (ftop + 1 < F.size() && F[ftop + 1][2] < x)
      |                ~~~~~~~~~^~~~~~~~~~
#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...