QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#507104#8727. DvobojPhysics2123030 76ms3860kbC++17719b2024-08-06 10:55:452024-08-06 10:55:45

Judging History

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

  • [2024-08-06 10:55:45]
  • 评测
  • 测评结果:0
  • 用时:76ms
  • 内存:3860kb
  • [2024-08-06 10:55:45]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main(){
  ios::sync_with_stdio(false);
  int n,q,l,k; cin>>n>>q,l=(k=__lg(n))>>1;
  vector s(n,vector<int>(k+1));
  for(int i=0;i<n;i++)
    cin>>s[i][0];
  auto bf=[&](int x){
    for(int i=1;i<=l;i++)
      for(int j=x<0?0:x;j+(1<<i)<=n&&(~x||j+(1<<i)<=x+(1<<l));j++)
        s[j][i]=abs(s[j][i-1]-s[j+(1<<i-1)][i-1]);
  };
  bf(-1);
  while(q--){
    int op,x,y; cin>>op>>x>>y;
    if(x--;op==1)s[x][0]=y,bf(x);
    else if(y<=l)cout<<s[x][y]<<'\n';
    else{
      for(int i=l+1;i<=y;i++)
        for(int j=x;j+(1<<i)<=x+(1<<y);j+=1<<i)
          s[j][i]=abs(s[j][i-1]-s[j+(1<<i-1)][i-1]);
      cout<<s[x][y]<<'\n';
    }
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3844kb

input:

10 10
1361914 207572678 628126347 376128984 883488318 186963880 762865354 326392578 98149107 158171745
2 2 3
1 2 570852623
2 1 3
1 10 841056888
2 1 3
1 10 496132858
2 1 1
2 3 3
1 3 99470035
1 7 296222622

output:

0
8054299
8054299
0
68076937

result:

wrong answer 1st numbers differ - expected: '260852338', found: '0'

Subtask #2:

score: 0
Wrong Answer

Test #11:

score: 13
Accepted
time: 44ms
memory: 3556kb

input:

2 200000
583392119 251603292
2 1 1
2 1 1
1 1 38574148
2 1 1
2 1 1
1 1 42719181
2 1 1
1 2 536876485
1 2 761201073
1 1 335510282
2 1 1
2 1 1
2 1 1
1 2 371383902
2 1 1
2 1 1
1 1 378794551
1 1 224150551
1 2 812716786
2 1 1
2 1 1
2 1 1
1 2 129793340
2 1 1
1 1 654577279
1 1 150709706
2 1 1
1 1 883829174
1...

output:

331788827
331788827
213029144
213029144
208884111
425690791
425690791
425690791
35873620
35873620
588566235
588566235
588566235
94357211
20916366
647936652
647936652
459423963
459423963
459423963
176008535
176008535
398886231
398886231
398886231
10658183
10658183
10658183
1477309
1477309
423872241
5...

result:

ok 99810 numbers

Test #12:

score: 0
Wrong Answer
time: 63ms
memory: 3848kb

input:

8 200000
583937365 30955631 71369406 563916968 642881599 641904678 121445755 920580908
2 1 3
1 5 540256764
1 8 562659914
2 1 3
1 6 770926584
2 1 3
2 1 3
2 1 3
2 1 3
2 1 3
2 1 3
1 2 843982298
1 5 935286660
1 3 978153407
1 7 383158846
1 5 832692766
1 2 58984923
2 1 3
1 5 599293737
1 7 891437740
2 1 3
...

output:

0
697487239
339566245
339566245
339566245
339566245
339566245
339566245
296501553
257091460
80217959
354180840
354180840
354180840
354180840
354180840
158968981
158968981
158968981
158968981
963743
11751605
11751605
319385798
319385798
333451673
333451673
333451673
333451673
333451673
333451673
6612...

result:

wrong answer 1st numbers differ - expected: '737724060', found: '0'

Subtask #3:

score: 0
Wrong Answer

Test #21:

score: 0
Wrong Answer
time: 47ms
memory: 3860kb

input:

10 200000
1 1 1 1 1 0 1 1 0 0
2 3 3
1 8 0
1 9 0
2 2 2
1 2 1
2 6 1
2 3 3
1 6 1
2 2 1
2 7 2
2 3 1
1 5 0
1 10 0
1 9 1
1 7 0
2 1 3
1 6 0
1 4 0
2 9 1
1 2 0
2 1 3
1 8 0
2 4 2
1 2 0
1 9 1
2 5 2
2 1 3
1 10 0
1 5 0
1 2 1
2 5 2
2 1 3
1 7 0
1 3 1
2 2 3
1 6 0
1 1 1
1 9 1
1 1 1
1 9 0
1 4 1
2 5 2
2 1 1
1 8 1
2 2 ...

output:

0
0
1
0
0
1
0
1
1
1
0
0
1
0
1
1
0
0
0
0
1
0
1
1
0
1
0
0
0
1
0
1
1
1
1
0
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
1
0
0
1
1
1
0
0
1
1
1
1
0
0
0
0
0
0
0
1
1
0
1
0
1
1
1
0
1
0
0
1
0
1
1
0
1
1
1
0
1
0
0
0
1
1
1
0
1
0
1
1
1
0
1
0
1
1
1
1
0
1
1
1
1
1
0
0
1
0
1
0
1
0
1
0
0
1
0
1
0
0
0
0
1
1
1
0
1
0
0
0
1
0
0
0
0
1
1
...

result:

wrong answer 1st numbers differ - expected: '1', found: '0'

Subtask #4:

score: 0
Wrong Answer

Test #36:

score: 0
Wrong Answer
time: 76ms
memory: 3496kb

input:

10 199991
37507664 194554609 209371390 279132948 336712965 55899332 339663138 116632087 630544272 741907097
2 9 1
2 1 2
2 8 1
2 5 2
2 7 2
2 3 2
2 1 1
2 2 2
2 3 2
2 8 1
2 5 2
2 1 2
2 7 2
2 3 3
2 3 3
2 2 3
2 3 3
2 8 1
2 5 2
2 5 1
2 1 3
2 1 3
2 6 2
2 2 3
2 6 2
2 3 2
2 9 1
2 1 3
2 4 1
2 5 2
2 1 3
2 7 1
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 1st numbers differ - expected: '111362825', found: '0'

Subtask #5:

score: 0
Skipped

Dependency #1:

0%