CSES - Datatähti 2024 alku - Results
Submission details
Task:Lumimyrsky
Sender:Akaseli
Submission time:2023-10-30 09:54:19 +0200
Language:C++ (C++20)
Status:COMPILE ERROR

Compiler report

input/code.cpp:4:1: error: expected unqualified-id before 'int'
    4 | int prevB = 0;
      | ^~~
input/code.cpp: In function 'int main()':
input/code.cpp:12:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   12 |         cin >> x;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:75,
                 from input/code.cpp:1:
/usr/include/c++/11/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;           /// Linked to standard input
      |                  ^~~
input/code.cpp:21:9: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   21 |         cin >> x;
      |         ^~~
      |         std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:75,
                 from input/code.cpp:1:
/usr/include/c++/11/iostream:60:18: note: 'std::cin' declared here
   60 |   extern istream cin;           /// Linked to standard input...

Code

#include <bits/stdc++.h>

int prevA = 0,
int prevB = 0;

int nousuA = 0;
int nousuB = 0;

int main(){
    for(int i = 0; i<10; i++){
        int x;
        cin >> x;
        if(x-prevA>0){
            nousuA += x;
        }
        prevA = x;
    }

    for(int i = 0; i<10; i++){
        int x;
        cin >> x;
        if(x-prevB>0){
            nousuB += x;
        }
        prevB = x;
    }

    if(nousuA<nousuB){
        cout << "1";
    }
    else{
        cout << "2";
    }
}