QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#243967 | #7199. Bomb | ucup-team004 | WA | 0ms | 3820kb | C++20 | 682b | 2023-11-08 19:49:58 | 2023-11-08 19:49:59 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
while (std::cin >> n) {
std::vector<int> x(n);
for (int i = 0; i < n; i++) {
std::cin >> x[i];
}
i64 ans = 0;
for (int i = 0; i < n; i++) {
int d = 0;
if (i) {
d = std::max(d, x[i] - x[i - 1]);
}
if (i < n - 1) {
d = std::max(d, x[i + 1] - x[i]);
}
ans += 1LL * d * d;
}
std::cout << ans << "\n";
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3548kb
input:
5 1 4 5 6 10 3 1 2 6
output:
51 33
result:
ok 2 tokens
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3820kb
input:
18 1 2 3 6 11 23 47 106 235 551 1301 3159 7741 19320 48629 123867 317955 823065 5 1 5 6 7 11 2 1 1000000 3 1 12345 1000000 4 1 2 3 1000000
output:
554621353432 65 1999996000002 1951077172386 1999988000020
result:
wrong answer 2nd words differ - expected: '59', found: '65'