| Task: | Increasing Array |
| Sender: | TuomoPera |
| Submission time: | 2020-09-26 13:20:18 +0300 |
| Language: | C++ (C++11) |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.01 s | details |
| #2 | WRONG ANSWER | 0.01 s | details |
| #3 | WRONG ANSWER | 0.01 s | details |
| #4 | WRONG ANSWER | 0.01 s | details |
| #5 | WRONG ANSWER | 0.01 s | details |
| #6 | WRONG ANSWER | 0.01 s | details |
| #7 | WRONG ANSWER | 0.01 s | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:10:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
freopen("cases.txt", "r", stdin);
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~Code
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
long long arr[200000];
int main() {
freopen("cases.txt", "r", stdin);
int num;
cin >> num;
long long result = 0 ;
if (num == 1) {
cout << "0" << endl;
return 0;
}
int first;
int second;
if (num == 2) {
cin >> first >> second;
if (second < first){
cout << first - second << endl;
return 0;
}
else{
cout << "0" << endl;
return 0;
}
}
cin >> first;
cin >> second;
for (int i = 0; i < num - 1; i++) {
if (second < first)
result += first - second;
first = second;
cin >> second;
}
cout << result << endl;
return 0;
}Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 10 1 1 1 1 1 1 1 1 1 1 |
| correct output |
|---|
| 0 |
| user output |
|---|
| 1429451931 |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 10 1000000000 1 1 1 1 1 1 1 1 1 |
| correct output |
|---|
| 8999999991 |
| user output |
|---|
| 1429451931 |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 10 6 10 4 10 2 8 9 2 7 7 |
| correct output |
|---|
| 31 |
| user output |
|---|
| 1429451931 |
Test 4
Verdict: WRONG ANSWER
| input |
|---|
| 200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| correct output |
|---|
| 0 |
| user output |
|---|
| 1429451931 |
Test 5
Verdict: WRONG ANSWER
| input |
|---|
| 200000 1000000000 1 1 1 1 1 1 1 1 1 1... |
| correct output |
|---|
| 199998999800001 |
| user output |
|---|
| 1429451931 |
Test 6
Verdict: WRONG ANSWER
| input |
|---|
| 200000 763977854 530688450 486447012 ... |
| correct output |
|---|
| 100126194120455 |
| user output |
|---|
| 1429451931 |
Test 7
Verdict: WRONG ANSWER
| input |
|---|
| 1 329873232 |
| correct output |
|---|
| 0 |
| user output |
|---|
| 1429451931 |
