Submission #197472

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
1974722020-01-21 12:12:28red1108Split the sequence (APIO14_sequence)C++17
0 / 100
121 ms84892 KiB
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define fastio ios_base::sync_with_stdio(false);cin.tie(0)
#define eb emplace_back
typedef long long ll;
typedef pair<ll,ll> pll;
struct A{
ll a, b;
int ind;
A(){}
A(ll x, ll y, int z){a=x;b=y;ind=z;}
};
struct CHT{
int top = 0;
vector<A> line;
void clear(){
top = 0;
line.clear();
}
double cross(A a, A b){
return (double)(b.b-a.b)/(double)(a.a-b.a);
}
void add(A l){
while(line.size()>1&&cross(line[line.size()-2], line.back())>=cross(line.back(), l)) line.pop_back();
line.eb(l);
}
pll get(ll x){
top = min(top, (int)line.size()-1);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

sequence.cpp: In member function 'pll CHT::get(ll)':
sequence.cpp:31:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(top+1<line.size()&&cross(line[top], line[top+1])<=x) top++;
         ~~~~~^~~~~~~~~~~~
sequence.cpp: In function 'int main()':
sequence.cpp:65:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=1;i<h.size();i++) cout<<h[i]<<" ";
              ~^~~~~~~~~
#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...