| Task: | Lumimyrsky |
| Sender: | ragulbalaji |
| Submission time: | 2023-10-30 19:58:32 +0200 |
| Language: | C++ (C++11) |
| Status: | READY |
| Result: | 100 |
| group | verdict | score |
|---|---|---|
| #1 | ACCEPTED | 100 |
| test | verdict | time | |
|---|---|---|---|
| #1 | ACCEPTED | 0.00 s | details |
| #2 | ACCEPTED | 0.00 s | details |
| #3 | ACCEPTED | 0.00 s | details |
| #4 | ACCEPTED | 0.00 s | details |
| #5 | ACCEPTED | 0.00 s | details |
| #6 | ACCEPTED | 0.00 s | details |
| #7 | ACCEPTED | 0.00 s | details |
| #8 | ACCEPTED | 0.00 s | details |
| #9 | ACCEPTED | 0.00 s | details |
| #10 | ACCEPTED | 0.00 s | details |
| #11 | ACCEPTED | 0.00 s | details |
Code
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
LL one = 0;
LL x0, x1;
cin >> x0;
for (int i = 1; i < 10; i++) {
cin >> x1;
one += max(x1 - x0, 0LL);
x0 = x1;
}
LL two = 0;
cin >> x0;
for (int i = 1; i < 10; i++) {
cin >> x1;
two += max(x1 - x0, 0LL);
x0 = x1;
}
if (one < two) {
cout << "1\n";
} else {
cout << "2\n";
}
return 0;
}
/*
A blizzard has surprised the residents of Syrjälä.
You are skiing to school. However, there are two separate routes to school, and
you want to choose the route with the least ascent. Going from height x to a
higher point y means an ascent of y-x units.
Your home and school are at height 0. You are given heights at various points
along each route and you have to choose the better one.
Input
The input consists of two lines.
The first line contains 10 integers describing heights at various points on
the first route.
The second line contains 10 integers describing heights at various points on
the second route.
Each height is between 0\dots100.
Output
Print 1 if the first route has less ascent, or 2 if the second route has
less ascent.
You can assume that the total ascent of the routes differ.
Example
Input:
0 0 3 3 1 2 2 2 1 0
0 1 2 3 2 2 3 0 1 1
Output:
1
Explanation: The heights along the routes are illustrated in the figure below.
The first route has 4 units of ascent while the second route
has 5 units of ascent. Thus the better choice is route 1.
Grading
You will get 100 points from the task if your code produces the correct
answer to each test.*/Test details
Test 1
Verdict: ACCEPTED
| input |
|---|
| 0 0 1 1 1 2 2 2 1 0 0 1 2 3 2 2 3 0 1 1 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 2
Verdict: ACCEPTED
| input |
|---|
| 1 1 1 1 1 1 1 1 0 1 1 0 0 0 1 0 1 0 0 0 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 3
Verdict: ACCEPTED
| input |
|---|
| 1 2 2 2 0 0 0 2 0 0 0 1 0 1 1 2 1 2 1 2 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 4
Verdict: ACCEPTED
| input |
|---|
| 4 2 0 10 6 10 4 5 4 3 3 1 2 7 6 1 3 5 2 6 |
| correct output |
|---|
| 2 |
| user output |
|---|
| 2 |
Test 5
Verdict: ACCEPTED
| input |
|---|
| 6 0 7 9 3 1 5 6 9 4 9 0 1 0 2 2 0 1 4 7 |
| correct output |
|---|
| 2 |
| user output |
|---|
| 2 |
Test 6
Verdict: ACCEPTED
| input |
|---|
| 10 9 6 1 10 9 7 6 7 6 2 1 10 2 0 7 2 9 4 6 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 7
Verdict: ACCEPTED
| input |
|---|
| 22 5 87 83 20 36 92 98 49 9 61 40 77 35 52 49 29 100 18 81 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
Test 8
Verdict: ACCEPTED
| input |
|---|
| 90 95 33 21 82 6 4 37 10 99 60 10 53 61 42 53 33 48 62 83 |
| correct output |
|---|
| 2 |
| user output |
|---|
| 2 |
Test 9
Verdict: ACCEPTED
| input |
|---|
| 7 22 78 32 44 98 73 46 98 31 54 26 50 8 7 42 27 1 50 53 |
| correct output |
|---|
| 2 |
| user output |
|---|
| 2 |
Test 10
Verdict: ACCEPTED
| input |
|---|
| 88 1 97 24 87 38 53 82 23 42 1 61 43 77 40 40 52 88 48 93 |
| correct output |
|---|
| 2 |
| user output |
|---|
| 2 |
Test 11
Verdict: ACCEPTED
| input |
|---|
| 1 36 50 50 50 0 13 31 14 1 22 88 42 13 25 13 8 39 34 49 |
| correct output |
|---|
| 1 |
| user output |
|---|
| 1 |
