CSES - Datatähti 2024 alku - Results
Submission details
Task:Lumimyrsky
Sender:Sisu K
Submission time:2023-10-30 17:45:42 +0200
Language:C++ (C++20)
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:9:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |   for(int i = 0; i < numbers.size(); i++){
      |                  ~~^~~~~~~~~~~~~~~~
input/code.cpp:12:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |   for(int i = 0; i < numbers2.size(); i++){
      |                  ~~^~~~~~~~~~~~~~~~~
input/code.cpp:18:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   for (int i = 0; i < numbers.size(); i++) {
      |                   ~~^~~~~~~~~~~~~~~~
input/code.cpp:30:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned...

Code

#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> numbers(10);
vector<int> numbers2(10);
for(int i = 0; i < numbers.size(); i++){
cin >> numbers[i];
}
for(int i = 0; i < numbers2.size(); i++){
cin >> numbers2[i];
}
int start = 0;
int up = 0;
for (int i = 0; i < numbers.size(); i++) {
if(start < numbers[i]){
up = numbers[i] - start + up;
start = numbers[i];
}
else if(start > numbers[i]){
start = numbers[i];
}
}
int start2 = 0;
int up2 = 0;
for (int i = 0; i < numbers2.size(); i++) {
if(start2 < numbers2[i]){
up2 = numbers2[i] - start2 + up2;
start2 = numbers2[i];
}
else if(start2 > numbers2[i]){
start2 = numbers2[i];
}
}
if(up < up2){
cout << "1"
}
else{
cout << "2"
}
}