Please sign in first.
Submission #17752503
Source Code Expand
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll N, K;
ll f (ll x) {
if (x <= 1) return 0;
if (x >= 2 * N + 1) return 0;
if (x <= N + 1) return x - 1;
return (2 * N + 1 - x);
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> N >> K;
ll ans = 0;
K = abs(K);
for (ll i = 2; i <= 2 * N; i++) {
ans += (f(i) * f(i + K));
}
cout << ans << '\n';
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | B - Quadruple |
| User | nakaken88 |
| Language | C++ (GCC 9.2.1) |
| Score | 400 |
| Code Size | 443 Byte |
| Status | AC |
| Exec Time | 4 ms |
| Memory | 3636 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 400 / 400 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00-sample-001.txt, 00-sample-002.txt |
| All | 00-sample-001.txt, 00-sample-002.txt, 01-001.txt, 01-002.txt, 01-003.txt, 01-004.txt, 01-005.txt, 01-006.txt, 01-007.txt, 01-008.txt, 01-009.txt, 01-010.txt, 01-011.txt, 01-012.txt, 01-013.txt, 01-014.txt, 01-015.txt, 01-016.txt, 01-017.txt, 01-018.txt, 01-019.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-001.txt | AC | 4 ms | 3532 KiB |
| 00-sample-002.txt | AC | 2 ms | 3484 KiB |
| 01-001.txt | AC | 2 ms | 3580 KiB |
| 01-002.txt | AC | 2 ms | 3480 KiB |
| 01-003.txt | AC | 2 ms | 3524 KiB |
| 01-004.txt | AC | 2 ms | 3564 KiB |
| 01-005.txt | AC | 2 ms | 3608 KiB |
| 01-006.txt | AC | 2 ms | 3580 KiB |
| 01-007.txt | AC | 2 ms | 3636 KiB |
| 01-008.txt | AC | 3 ms | 3516 KiB |
| 01-009.txt | AC | 2 ms | 3604 KiB |
| 01-010.txt | AC | 2 ms | 3576 KiB |
| 01-011.txt | AC | 2 ms | 3632 KiB |
| 01-012.txt | AC | 2 ms | 3564 KiB |
| 01-013.txt | AC | 4 ms | 3532 KiB |
| 01-014.txt | AC | 2 ms | 3480 KiB |
| 01-015.txt | AC | 3 ms | 3528 KiB |
| 01-016.txt | AC | 2 ms | 3536 KiB |
| 01-017.txt | AC | 3 ms | 3608 KiB |
| 01-018.txt | AC | 2 ms | 3540 KiB |
| 01-019.txt | AC | 2 ms | 3524 KiB |