# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
626059 | Blagoj | Addk (eJOI21_addk) | C++14 | 1396 ms | 964 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
int main()
{
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
int n, q, k;
cin >> n >> k;
int a[n + 1];
for (int i = 1; i <= n; i++)
{
cin >> a[i];
}
cin >> q;
int type, l, r, m;
ll sum;
int turn = 0, p1, p2;
while (q--)
{
cin >> type;
if (type == 1)
{
for (int i = 0; i < k; i++)
{
cin >> type;
}
continue;
}
cin >> l >> r >> m;
sum = 0;
p1 = l, p2 = r;
while (p1 <= p2)
{
sum += a[p1] * min((p1 - l + 1), m);
p1++;
if ((r - l) % 2 == 0)
{
if (p1 > p2)
{
break;
}
}
sum += a[p2] * min((r - p2 + 1), m);
p2--;
}
cout << sum << "\n";
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |