| Task: | Increasing Array |
| Sender: | israil1601 |
| Submission time: | 2020-09-26 14:08:23 +0300 |
| Language: | C++ (C++17) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.01 s | details |
| #2 | WRONG ANSWER | 0.01 s | details |
| #3 | ACCEPTED | 0.01 s | details |
| #4 | ACCEPTED | 0.04 s | details |
| #5 | WRONG ANSWER | 0.04 s | details |
| #6 | WRONG ANSWER | 0.09 s | details |
| #7 | ACCEPTED | 0.01 s | details |
Code
#include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
int r = 0;
for (int i = 0; i < n - 1; i++)
{
if (a[i] > a[i + 1])
{
r += a[i] - a[i + 1];
a[i + 1] = a[i];
}
}
cout << r;
return 0;
}Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 10 1 1 1 1 1 1 1 1 1 1 |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 10 1000000000 1 1 1 1 1 1 1 1 1 |
| correct output |
|---|
| 8999999991 |
| user output |
|---|
| 410065399 |
Test 3
Verdict: ACCEPTED
| input |
|---|
| 10 6 10 4 10 2 8 9 2 7 7 |
| correct output |
|---|
| 31 |
| user output |
|---|
| 31 |
Test 4
Verdict: ACCEPTED
| input |
|---|
| 200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 200000 1000000000 1 1 1 1 1 1 1 1 1 1... |
| correct output |
|---|
| 199998999800001 |
| user output |
|---|
| -447305535 |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 200000 763977854 530688450 486447012 ... |
| correct output |
|---|
| 100126194120455 |
| user output |
|---|
| 1916516103 |
Test 7
Verdict: ACCEPTED
| input |
|---|
| 1 329873232 |
| correct output |
|---|
| 0 |
| user output |
|---|
| 0 |
