CSES - Datatähti 2024 alku - Results
Submission details
Task:Lumimyrsky
Sender:AH
Submission time:2023-11-01 10:08:20 +0200
Language:C++ (C++20)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:14:12: error: expected '(' before 'path1'
   14 |         if path1[i] > prevNum {
      |            ^~~~~
      |            (
input/code.cpp:22:12: error: expected '(' before 'path2'
   22 |         if path2[i] > prevNum {
      |            ^~~~~
      |            (
input/code.cpp:7:9: warning: unused variable 'count1' [-Wunused-variable]
    7 |     int count1 = 0;
      |         ^~~~~~
input/code.cpp:8:9: warning: unused variable 'count2' [-Wunused-variable]
    8 |     int count2 = 0;
      |         ^~~~~~

Code

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int prevNum = 0;
    int count1 = 0;
    int count2 = 0;
    int answer = 0;
    // Luetaan syöte
    vector<int> path1(10);
    for (int i = 0; i < 10; i++) {
        cin >> path1[i];
        if path1[i] > prevNum {
            count1 = count1 + path1[i] - prevNum;
        };
        prevNum = path1[i];
    }
    vector<int> path2(10);
    for (int i = 0; i < 10; i++) {
        cin >> path2[i];
        if path2[i] > prevNum {
                    count2 = count2 + path2[i] - prevNum;
            };
        prevNum = path2[i];
    }

    // Tulostetaan vastaus
    cout << answer << endl;
}