# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
632002 | 2022-08-19T09:45:35 Z | Jovan26 | Addk (eJOI21_addk) | C++14 | 242 ms | 868 KB |
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int k; cin>>k; int a[n]; for(int i=0;i<n;i++) cin>>a[i]; int q; cin>>q; bool p = false; vector<long long> v; for(int j=0;j<q;j++){ int x; cin>>x; if(x==1){ int y; cin>>y; continue; } int l,r,m; p = true; cin>>l>>r>>m; int ma = min(m,(r-l+1-m+1)); long long rez = 0; for(int i=l-1;i<l+ma-2;i++){ rez+=(i-l+2)*a[i]; } for(int i=r-1;i>=r-ma;i--){ rez+=(r-i)*a[i]; } for(int i=l+ma-2;i<r-ma;i++){ rez+=a[i]*ma; } v.push_back(rez); } if(p){ for(int i=0;i<v.size()-1;i++) cout<<v[i]<<endl; cout<<v[v.size()-1]; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 4 ms | 296 KB | Output is correct |
3 | Correct | 8 ms | 348 KB | Output is correct |
4 | Correct | 12 ms | 332 KB | Output is correct |
5 | Correct | 17 ms | 340 KB | Output is correct |
6 | Incorrect | 23 ms | 468 KB | Output isn't correct |
7 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 242 ms | 868 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 17 ms | 748 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |