CSES - Datatähti 2024 alku - Results
Submission details
Task:Laskettelukeskus
Sender:Ihminen
Submission time:2023-11-01 18:28:55 +0200
Language:C++ (C++17)
Status:COMPILE ERROR

Compiler report

input/code.cpp:16:14: error: stray '\344' in program
   16 |         int väli = 0;
      |              ^
input/code.cpp:17:17: error: stray '\344' in program
   17 |         cin >> väli;
      |                 ^
input/code.cpp:18:21: error: stray '\344' in program
   18 |         Polut[i] = väli;
      |                     ^
input/code.cpp: In function 'int main()':
input/code.cpp:16:15: error: expected initializer before 'li'
   16 |         int väli = 0;
      |               ^~
input/code.cpp:17:16: error: 'v' was not declared in this scope
   17 |         cin >> väli;
      |                ^

Code

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


int main() {
    // Luetaan syöte
    int lukumaara;
    cin >> lukumaara;
    int summa = 0;

    vector<bool> VarteenOtettavat(100000);
    vector<int> Polut(100000);
    for (int i = 0; i < (lukumaara-1)*2; i++) {
        VarteenOtettavat[i] = true;
        int väli = 0;
        cin >> väli;
        Polut[i] = väli;
        if (i % 2 == 0 && i!=0) {
            
            VarteenOtettavat[Polut[i]-1] = false;
        }

    }
    
    vector<int> Aurauskerrat(100000);
   
    for (int i = 0; i < lukumaara; i++) {
        cin >> Aurauskerrat[i];
        
    }

    for (int k = 0; k < lukumaara; k++)
    {
        if (VarteenOtettavat[k]) {
            
            summa += Aurauskerrat[k];
        }
    }
    

    

    // Tulostetaan vastaus
    cout << summa << "\n";
   
    
}