제출 #224888

#제출 시각아이디문제언어결과실행 시간메모리
224888bukanYohandiSolar Storm (NOI20_solarstorm)C++14
15 / 100
713 ms15944 KiB
#include <bits/stdc++.h> /* Karya anak bangsa yang paling agung Author : Yohandi or... bukan.. */ #define fs first #define sc second #define pb push_back #define eb emplace_back #define all(a) a.begin(),a.end() #define lb(a,x) (lower_bound(all(a),x)-a.begin()) #define ub(a,x) (upper_bound(all(a),x)-a.begin()) #define rep(a,x,y) for(int a=(int)x;a<=(int)y;++a) #define repd(a,x,y,d) for(int a=(int)x;a<=(int)y;a+=d) #define res(a,x,y) for(int a=(int)x;a>=(int)y;--a) #define resd(a,x,y,d) for(int a=(int)x;a>=(int)y;a-=d) // Ordered Set, Ordered Multiset #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> #define o_set tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> #define o_multiset tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> using namespace __gnu_pbds; // .order_of_key(x) -> Number of elements less than x // * .find_by_order(k) -> Kth smallest element (0-based) // .erase(x) -> Remove all elements equal to x #pragma GCC optimize("Ofast") #pragma GCC optimize ("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") using namespace std; using lint=long long; mt19937 rng(time(NULL)); lint Power(lint A,lint B,lint C){ if(!B) return 1LL; lint tmp=Power(A,B>>1,C); return tmp*tmp%C*(B&1?A:1)%C; } int T,N,S; int D[1111111]; lint K; lint V[1111111]; bool Solve2(){ if(S!=1) return 0; for(int i=1;i<=N-1;++i) if(D[i]!=1) return 0; if(2*K+1>=N){ cout<<1<<endl; cout<<(N+1)/2<<endl; return 1; } for(int i=1;i<=N;++i) V[i]+=V[i-1]; pair<lint,int> Ans={-1,0}; for(int i=K+1;i<=N-K;++i) Ans=max(Ans,{V[i+K]-V[i-K-1],i}); cout<<1<<endl; cout<<Ans.sc<<endl; return 1; } bool Solve4(){ if(K!=1) return 0; for(int i=1;i<=N-1;++i) if(D[i]!=2) return 0; for(int i=1;i<=N;++i) V[i]+=V[i-1]; pair<lint,int> Ans={-1,0}; for(int i=S;i<=N;++i) Ans=max(Ans,{V[i]-V[i-S],i}); cout<<S<<endl; for(int i=Ans.sc-S+1;i<=Ans.sc;++i) cout<<i<<((i==Ans.sc)?"\n":" "); return 1; } int main(){ // ios_base::sync_with_stdio(0); // cin.tie(0); cout.tie(0); T=1; // cin>>T; rep(t,1,T){ cin>>N>>S>>K; for(int i=1;i<=N-1;++i) cin>>D[i]; for(int i=1;i<=N;++i) cin>>V[i]; if(Solve2()) return 0; if(Solve4()) return 0; } return 0; }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...