QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#22952#2887. 区间矩阵乘法hy_zheng_zai_nei_juan#WA 282ms358000kbC++201.8kb2022-03-11 12:08:072022-04-30 02:10:26

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 02:10:26]
  • 评测
  • 测评结果:WA
  • 用时:282ms
  • 内存:358000kb
  • [2022-03-11 12:08:07]
  • 提交

answer

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<vector>
#include<queue>
#include<algorithm>
#include<string>
#include<sstream>
#include<cctype>
#include<cmath>
#include<iomanip>
#include<map>
#include<stack>
#include<set>
#include<functional>
#define in(x) x=read()
#define qr read()
// #define int ll
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
namespace fastIO
{
    #define BUF_SIZE 100000
    bool IOerror=0;
    inline char nc()
	{
        static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;
        if (p1==pend){
            p1=buf; pend=buf+fread(buf,1,BUF_SIZE,stdin);
            if (pend==p1){IOerror=1;return -1;}
        }
        return *p1++;
    }
    inline bool blank(char ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';}
    inline ll read()
	{
        bool sign=0; char ch=nc();ll x=0;
        for (;blank(ch);ch=nc());
        if (IOerror)return 0;
        if (ch=='-')sign=1,ch=nc();
        for (;ch>='0'&&ch<='9';ch=nc())x=x*10+ch-'0';
        if (sign)x=-x;
        return x;
    }
    #undef BUF_SIZE
};
using namespace fastIO;
#define blk 450
unsigned sum[500][200010];
int a[1000010];
signed main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int n=qr;
	for(int i=1;i<=n;i++)in(a[i]);
	for(int j=1;j<=blk;j++)
	for(int i=1;i<=n;i++)
	{
		sum[j][i]=sum[j][max(0,i-j)]+a[i];
	}
	int m=qr;
	while(m--)
	{
		int d=qr,p1=qr,p2=qr;
		unsigned ans=0;
		for(int p=p2,j=0;j<d;p+=d,j++)
		{
			// cout<<p+d-1<<"-"<<p-1<<'\n';
			// cout<<j<<":"<<(sum[1][p+d-1]-sum[1][p-1])<<' '<<(sum[d][p1+d*(d-1)+j]-sum[d][p1+j-d])<<'\n';
			ans+=(sum[1][p+d-1]-sum[1][p-1])*(sum[d][p1+d*(d-1)+j]-sum[d][p1+j-d]);
		}
		cout<<ans<<'\n';
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 33936kb

input:

8
1 2 2 2 2 2 1 1
2
2 2 2
1 3 7

output:

32
2

result:

ok 2 lines

Test #2:

score: -100
Wrong Answer
time: 282ms
memory: 358000kb

input:

200000
110569 155 159393 154631 169597 134901 75060 60085 189794 169502 10184 170809 170894 5697 83892 99814 97985 11604 39943 171446 77088 44463 60432 121559 54578 115592 151722 115322 147103 126168 55464 42044 181426 196809 58680 173065 136429 76030 109558 78475 161094 46875 1564 177386 108053 828...

output:

4189305368
55181820
2129409470
700818946
3501766645
1730563858
3899557935
4020833941
1896225959
3402813306
1636148212
106070907
1868972913
406568818
4117597926
65997073
3713307242
3060762232
2968862403
705700646
1131106229
4118099190
420297313
2760229439
4118078127
4042393869
1482472642
1219344853
3...

result:

wrong answer 79th lines differ - expected: '3304112948', found: '2515312960'