QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#550055 | #9242. An Easy Geometry Problem | ucup-team3555# | WA | 1ms | 3712kb | C++20 | 602b | 2024-09-07 09:17:43 | 2024-09-07 09:17:44 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int N=2e5+3;
ll n,m,K,B,a[N],b[N];
int main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
cin>>n>>m>>K>>B;
for(int i=1;i<=n;i++)cin>>a[i];
for(int i=1;i<n;i++)b[i]=a[i+1]-a[i];
while(m--)
{
int op,l,r,d;cin>>op>>l;
if(op==1)
{
cin>>r>>d;
if(l>1)b[l-1]+=d;
if(r<n)b[r]-=d;
}
else
{
if(l==1||b[l-1]+b[l]!=K+B){cout<<0<<"\n";continue;}
int s=1;
for(int i=l-2,j=l+1;i>0&&j<n&&b[i]+b[j]==K;i++,j--)s++;
cout<<s<<"\n";
}
}
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3624kb
input:
6 6 6 2 1 5 9 10 15 18 2 2 1 3 3 -3 2 2 1 3 4 3 2 3 2 4
output:
1 0 2 0
result:
ok 4 number(s): "1 0 2 0"
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3712kb
input:
5000 5000 2 0 -329 -328 -327 -326 -325 -324 -323 -322 -321 -320 -319 -318 -317 -316 -315 -314 -313 -312 -311 -310 -309 -308 -307 -306 -305 -304 -303 -302 -301 -300 -299 -298 -297 -296 -295 -294 -293 -292 -291 -290 -289 -288 -287 -286 -285 -284 -283 -282 -281 -280 -279 -278 -277 -276 -275 -274 -273 -...
output:
5 307 76 32 64 295 142 51 20 102 9 8 56 96 6 94 68 32 36 309 24 27 20 24 284 15 19 1 36 10 21 99 10 43 42 16 10 49 46 19 1 75 36 19 25 8 9 192 30 1 38 110 46 37 6 30 23 24 47 59 99 39 5 30 25 33 35 9 8 108 30 40 15 61 5 24 157 20 113 60 6 10 36 18 27 97 71 28 1 17 13 7 13 5 28 42 39 36 167 14 22 184...
result:
wrong answer 1st numbers differ - expected: '2', found: '5'