QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#660666#9242. An Easy Geometry Problem_CHO#WA 9ms3600kbC++20648b2024-10-20 12:35:482024-10-20 12:35:48

Judging History

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

  • [2024-10-20 12:35:48]
  • 评测
  • 测评结果:WA
  • 用时:9ms
  • 内存:3600kb
  • [2024-10-20 12:35:48]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
const int maxn = 2e5+100;

i64 n,Q,k,b;
i64 A[maxn];

main(){
    cin>>n>>Q>>k>>b;
    for(int i=1;i<=n;++i) cin >> A[i];
    while(Q--){
        int opt,l,r,v,idx; cin>>opt;
        if(opt==1){
            cin >> l >> r >> v;
            for(int i=l;i<=r;++i) A[i] += v;
        }else if(opt==2){
            cin >> idx;
            int lim = max(0ll,min(idx-1ll,n-idx));
            int ans = 0;
            for(int r=1;r<=lim;++r){
                if(A[idx+r] - A[idx-r] == k*r+b) ans = r;
            }
            cout<<ans<<'\n';
        }
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3600kb

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: 9ms
memory: 3588kb

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:

2
304
73
29
61
292
139
48
116
99
6
5
53
93
3
91
65
29
33
306
21
24
17
21
281
12
16
1
33
7
18
96
7
40
39
13
7
49
43
79
48
138
65
67
22
118
6
189
71
84
247
107
114
34
3
79
20
21
53
91
96
36
27
27
22
30
32
151
40
310
27
62
116
145
62
74
154
176
171
57
148
90
33
15
28
155
119
25
115
14
10
95
133
2
34
39...

result:

wrong answer 9th numbers differ - expected: '17', found: '116'