CSES - Datatähti 2025 alku - Results
Submission details
Task:Robotti
Sender:osmukka
Submission time:2024-11-04 11:49:55 +0200
Language:C++ (C++17)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:29:28: error: expected ';' before 'return'
   29 |     std::cout << "Finished"
      |                            ^
      |                            ;
   30 |     return 0;
      |     ~~~~~~                  
input/code.cpp:10:9: warning: unused variable 'steps' [-Wunused-variable]
   10 |     int steps = 0;
      |         ^~~~~
input/code.cpp:11:9: warning: unused variable 'coins' [-Wunused-variable]
   11 |     int coins = 0;
      |         ^~~~~

Code

#include <iostream>
#include <vector>
#include <string>

int main()
{
    int amount;
    char rooms[amount];
    int robot_index;
    int steps = 0;
    int coins = 0;

    std::cin >> amount;
    std::cin >> rooms;

    std::vector<int> coin_rooms;
    for(int i = 0; i < amount; i++)
    {
        switch(rooms[i])
        {
            case '*':
                coin_rooms.push_back(i);
                break;
            case 'R':
                coin_rooms.push_back(i);
                robot_index = coin_rooms.size()-1;
        }
    }
    std::cout << "Finished"
    return 0;
    
}