正文
增加 10 行删除 10 行
96 行未改动9798991001011021031041056 行未改动11211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414542 行未改动18818919019119219319419519611 行未改动20820921021121221321421521613 行未改动23023123223323423523623723818 行未改动96 行未改动#ifdef INPUT_OPTIMIZE#ifdef __unix__#include<sys/mman.h>inline static const char *_read_ptr = (const char *)mmap(nullptr, 0x7fffffff, 1, 2, 0, 0);#define getchar() (*_read_ptr++)#elsestatic char buf[Read_buf], *p1 = buf, *p2 = buf;#define getchar() p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, Read_buf, stdin), p1 == p2) ? EOF : *p1++#endif6 行未改动while (!isspace(c)) *pd++ = c, c = getchar();return c == EOF;}template <typename T>inline bool read(T &t) {t=0;T sgn=1;char c = getchar();while (!isdigit(c)) {if(c == '-')sgn *= -1;c = getchar();}while (isdigit(c)) t = (t << 3) + (t << 1) + (c ^ 48), c = getchar();t*=sgn;return c == EOF;}template <typename T, typename... Args>inline bool read(T &t, Args&... args) {return read(t) ? 1 : read(args...);}#ifdef OUTPUT_OPTIMIZEstatic char outbuf[Write_buf], *out = outbuf;#define putchar(x) *out++ = x#define flush() fwrite(outbuf, 1, out - outbuf, stdout)#else#define flush() 0#endiftemplate<typename T>inlinevoid write(T x) {if (!x) return putchar('0'), void();static char t[9], p = 0;if(x<0){putchar('-');x=-x;}42 行未改动if(fans>=k)return fsiz;if(cnt.p<k)return -1;long long l,r,ans;l=1,r=1,ans=n+1;res=opt({});while(l<=n) {11 行未改动fans=res.p;}else if(ans==r-l) fans=max(fans,res.p);res-=A[l++];}return ans;}vector<pair<int,int>> qst;13 行未改动signed main() {read(n,q);for(int i=1;i<=n;++i) read(arr[i]);for(int i=1;i<=n;++i) A[i]=arr[i],cnt+=A[i],Blocks[i/B]+=A[i];long long op,p,x,k;for(int i=1;i<=q;++i) {read(op);if(op==1) {18 行未改动96 行未改动9798991001011021031041056 行未改动11211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414542 行未改动18818919019119219319419519611 行未改动20820921021121221321421521613 行未改动23023123223323423523623723818 行未改动96 行未改动#ifdef INPUT_OPTIMIZE#ifdef __unix__#include<sys/mman.h>inline static const char *_read_ptr = (const char *)mmap(nullptr, 0x7fffffff, 1, 2, 0, 0);#define getchar() (*_read_ptr++)#elsestatic char buf[Read_buf], *p1 = buf, *p2 = buf;#define getchar() p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, Read_buf, stdin), p1 == p2) ? EOF : *p1++#endif6 行未改动while (!isspace(c)) *pd++ = c, c = getchar();return c == EOF;}template <typename T>inline bool read(T &t) {t=0;T sgn=1;char c = getchar();while (!isdigit(c)) {if(c == '-')sgn *= -1;c = getchar();}while (isdigit(c)) t = (t << 3) + (t << 1) + (c ^ 48), c = getchar();t*=sgn;return c == EOF;}template <typename T, typename... Args>inline bool read(T &t, Args&... args) {return read(t) ? 1 : read(args...);}#ifdef OUTPUT_OPTIMIZEstatic char outbuf[Write_buf], *out = outbuf;#define putchar(x) *out++ = x#define flush() fwrite(outbuf, 1, out - outbuf, stdout)#else#define flush() 0#endiftemplate<typename T>inlinevoid write(T x) {if (!x) return putchar('0'), void();static char t[9], p = 0;if(x<0){putchar('-');x=-x;}42 行未改动if(fans>=k)return fsiz;if(cnt.p<k)return -1;long long l,r,ans;l=1,r=1,ans=n+1;res=opt({});while(l<=n) {11 行未改动fans=res.p;}else if(ans==r-l) fans=max(fans,res.p);res-=A[l++];}return ans;}vector<pair<int,int>> qst;13 行未改动signed main() {read(n,q);for(int i=1;i<=n;++i) read(arr[i]);for(int i=1;i<=n;++i) A[i]=arr[i],cnt+=A[i],Blocks[i/B]+=A[i];long long op,p,x,k;for(int i=1;i<=q;++i) {read(op);if(op==1) {18 行未改动