QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#211437#7522. Sequence ShiftkkioRE 7ms58484kbC++203.1kb2023-10-12 16:22:532023-10-12 16:22:54

Judging History

你现在查看的是最新测评结果

  • [2023-10-12 16:22:54]
  • 评测
  • 测评结果:RE
  • 用时:7ms
  • 内存:58484kb
  • [2023-10-12 16:22:53]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
namespace FastIO {
	struct IO {
	    char ibuf[(1 << 20) + 1], *iS, *iT, obuf[(1 << 20) + 1], *oS;
	    IO() : iS(ibuf), iT(ibuf), oS(obuf) {} ~IO() { fwrite(obuf, 1, oS - obuf, stdout); }
		#if ONLINE_JUDGE
		#define gh() (iS == iT ? iT = (iS = ibuf) + fread(ibuf, 1, (1 << 20) + 1, stdin), (iS == iT ? EOF : *iS++) : *iS++)
		#else
		#define gh() getchar()
		#endif
		inline bool eof (const char &ch) { return ch == ' ' || ch == '\n' || ch == '\r' || ch == 't' || ch == EOF; }
	    inline long long read() {
	        char ch = gh();
	        long long x = 0;
	        bool t = 0;
	        while (ch < '0' || ch > '9') t |= ch == '-', ch = gh();
	        while (ch >= '0' && ch <= '9') x = (x << 1) + (x << 3) + (ch ^ 48), ch = gh();
	        return t ? ~(x - 1) : x;
	    }
	    inline void read (char *s) {
	    	char ch = gh(); int l = 0;
	    	while (eof(ch)) ch = gh();
	    	while (!eof(ch)) s[l++] = ch, ch = gh();
	    }
	    inline void read (double &x) {
	    	char ch = gh(); bool t = 0;
	    	while (ch < '0' || ch > '9') t |= ch == '-', ch = gh();
	    	while (ch >= '0' && ch <= '9') x = x * 10 + (ch ^ 48), ch = gh();
	    	if (ch != '.') return t && (x = -x), void(); ch = gh();
	    	for (double cf = 0.1; '0' <= ch && ch <= '9'; ch = gh(), cf *= 0.1) x += cf * (ch ^ 48);
	    	t && (x = -x);
	    }
	    inline void pc (char ch) {
	    	#ifdef ONLINE_JUDGE
	    	if (oS == obuf + (1 << 20) + 1) fwrite(obuf, 1, oS - obuf, stdout), oS = obuf; 
	    	*oS++ = ch;
	    	#else
	    	putchar(ch);
	    	#endif
		}
		template<typename _Tp>
	    inline void write (_Tp x) {
	    	static char stk[64], *tp = stk;
	    	if (x < 0) x = ~(x - 1), pc('-');
			do *tp++ = x % 10, x /= 10;
			while (x);
			while (tp != stk) pc((*--tp) | 48);
	    }
	    inline void puts(const char *s){
			int len = strlen(s);
			for (int i = 0; i < len; i++)pc(s[i]);
		}
	} io;
	inline long long read () { return io.read(); }
	template<typename Tp>
	inline void read (Tp &x) { io.read(x); }
	template<typename _Tp>
	inline void write (_Tp x) { io.write(x); }
}
using namespace FastIO;
const int maxn=2e6+10,W=1e9;
int n,m;
int s[maxn],t[maxn],ans[maxn];
vector< pair<int,int> > pa[maxn];
vector<int> p1;
int main()
{
    n=read(),m=read();
    for(int i=1;i<=n;i++)s[i]=read();
    for(int i=1;i<=n;i++)t[i]=read();
    int T=ceil(W/sqrt(n));
    for(int i=1;i<=n;i++)if(s[i]>W-T)p1.push_back(i);
    for(int i=1;i<=n;i++)if(s[i]>W-T&&t[i]>W-T)pa[1].push_back({i,i});
    int lst=0;
    for(int i=1;i<=m+1;i++)
    {
        if(i>1)
        {
            t[i+n-1]=read()^lst;
            if(t[i+n-1]>W-T)
                for(int pos1:p1)
                {
                    int st=i-pos1+1;
                    if(st<=m+1)pa[st].push_back({pos1,i-n+1});
                }
        }
        if(pa[i].size())
            for(auto [c1,c2]:pa[i])ans[i]=max(ans[i],s[c1]+t[c2]);
        else{
            for(int j=1;j<=n;j++)ans[i]=max(ans[i],s[j]+t[i+j-1]);
        }
        printf("%d\n",lst=ans[i]);
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 3ms
memory: 58484kb

input:

5 3
1 4 3 2 5
7 5 8 3 2
3
6
4

output:

11
13
16
25

result:

ok 4 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 56776kb

input:

1 0
103509429
823330096

output:

926839525

result:

ok single line: '926839525'

Test #3:

score: 0
Accepted
time: 4ms
memory: 57048kb

input:

1 1
576560149
691846236
1156187222

output:

1268406385
835582012

result:

ok 2 lines

Test #4:

score: 0
Accepted
time: 7ms
memory: 57128kb

input:

1 10
700282491
332230980
90825676
1630266999
644973380
262379760
2122877054
1851957134
1370195232
110993724
1319359505
1883523208

output:

1032513471
1654684398
759763732
888538827
1695749302
1163465539
1425605448
789576931
1397740634
1202288326
1638577353

result:

ok 11 lines

Test #5:

score: -100
Runtime Error

input:

1000 100000
438001359 929744877 710148392 323984311 727016267 323629255 495752276 309120511 312675195 717795522 937464489 624952229 444774478 829169766 707441777 609125148 25459976 849166512 716162953 882416779 189669312 135698832 632796131 592794700 569746403 231058028 389412868 824283503 801480367...

output:


result: