QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#818650 | #9864. Coin | zhouyidie | WA | 0ms | 3688kb | C++14 | 727b | 2024-12-18 00:53:28 | 2024-12-18 00:53:29 |
Judging History
answer
#include<bits/stdc++.h>
#define LL long long
using namespace std;
const int N=1e5+100;
int n,q;
LL a[N];
map<LL,LL> mp ;
void solve(){
cin >> n >> q ;
mp.clear() ;
for (int i = 1 ; i <= n ; i ++ ) {
cin >> a[i];
}
a[n+1] = a[n]+1;
for (LL i = 1 ; i < n ; i++ ) {
LL lt = (i) , rt = n-i;
mp[(LL)(i*(n-i))] += a[i+1] - a[i];
if(i ==n-1) mp[(LL)(i*(n-i))] += 1;
}
for (int i = 1 ; i <= q; i ++ ) {
LL x ; cin >> x ;
cout << mp[x] << " " ;
}
cout << '\n';
}
int main(){
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int T=1;
cin>>T;
while(T--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3688kb
input:
4 6 2 8 3 10000 2 1919810 114514
output:
0 0 0 0 0 0 0 0
result:
wrong answer 1st numbers differ - expected: '4', found: '0'