Submission #935178

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9351782024-02-28 18:55:21kimChorus (JOI23_chorus)C++17
100 / 100
1444 ms55672 KiB
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using pii=pair<int,int>;
#define f first
#define s second
#define eb emplace_back
const ll inf=1e18;
int a[1000005],b[1000005],pos[1000005],pos2[1000005];
ll qs[1000005];
pair<ll,int> dp2[1000005];
struct line{
ll m,c;
int cnt;
line(ll m,ll c,int cnt):m(m),c(c),cnt(cnt){}
ll operator()(const ll x)const{return m*x+c;}
};
struct cht{
deque<line> dq;
bool check(line a,line b,line c){
return (a.c-b.c)*(c.m-a.m)>=(a.c-c.c)*(b.m-a.m);
}
void insert(ll m,ll c,int cnt){
line f(m,c,cnt);
while(dq.size()>1&&check(dq.end()[-2],dq.back(),f)) dq.pop_back();
dq.eb(f);
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

chorus.cpp: In function 'int main()':
chorus.cpp:57:28: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |     for(int i=0,ia=0,ib=0;i<s.length();++i){
      |                           ~^~~~~~~~~~~
chorus.cpp:73:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   73 |         ll mid=l+r>>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...