# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1071695 |
2024-08-23T10:06:41 Z |
vjudge1 |
Addk (eJOI21_addk) |
C++17 |
|
2000 ms |
8348 KB |
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
int a[n];
for(int i=1; i<=n ;i++){
cin>>a[i];
}
int q;
cin>>q;
while(q--){
int qq;
cin>>qq;
if (qq==1){
if (k!=1){
int b[k];
for(int i=1 ;i<=k ;i++){
cin>>b[i];
}
int qweodkgogrsunbfdkcmvmspwiengdifjbdjnbdiuwpriqfpgfbndkckscvnxzojdsnbieuriwmslvifbdjnnbkviduwebqejbsdiv=b[1];
for(int i=1; i<k ;i++){
a[b[i]]=a[b[i+1]];
}
a[b[k]]=qweodkgogrsunbfdkcmvmspwiengdifjbdjnbdiuwpriqfpgfbndkckscvnxzojdsnbieuriwmslvifbdjnnbkviduwebqejbsdiv;
for(int i=1; i<=n; i++){
cout<<a[i]<<" ";
}
cout<<"\n";
}
}
else{
int l,r,m;
cin>>l>>r>>m;
long long sum=0;
//cout<<"\n";
// 2 3 5 2
for(int i=l ;i<=r-m+1; i++){
for(int j=i ;j<i+m ;j++){
sum+=a[j];
}
}
cout<<sum<<"\n";
}
}
}
/*
8 3
7 2 5 1 9 3 4 6
1
2 2 7 4
5 1
2 3 1 6 3
5
2 1 3 2
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1336 ms |
516 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2086 ms |
8348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |