제출 #550941

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
5509412022-04-19 12:51:54Pherokung수열 (APIO14_sequence)C++14
89 / 100
1043 ms81124 KiB
#include<bits/stdc++.h>
using namespace std;
#define N 100005
#define K 205
#define ll long long
typedef pair<ll,int> pa;
struct line{
ll m,c;
int idx;
line(ll m,ll c,int i) : m(m), c(c), idx(i) {}
ll dot(ll x){ return m*x + c;}
ll inter(line l){ return floor((long double)(c-l.c)/(l.m-m));}
};
struct CHT{
deque<line> hull;
void add(line l){
if(hull.size() >= 1 && hull.back().m == l.m && hull.back().c == l.c) hull.pop_back();
while(hull.size() >= 2 && l.inter(hull.back()) <= hull.back().inter(hull[hull.size()-2])) hull.pop_back();
hull.push_back(l);
}
pa query(ll x){
while(hull.size() >= 2 && hull[0].dot(x) <= hull[1].dot(x)) hull.pop_front();
return {hull[0].dot(x), hull[0].idx};
}
};
int n,k,a[N],pre[N],P[K][N],pos;
ll dp[2][N],ans;
int main(){
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

sequence.cpp: In function 'int main()':
sequence.cpp:31:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |  scanf("%d%d",&n,&k);
      |  ~~~~~^~~~~~~~~~~~~~
sequence.cpp:32:29: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |  for(int i=1;i<=n;i++) scanf("%d",&a[i]), pre[i] = pre[i-1] + a[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...