Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d09807f

Browse files
committed
Add Solution for lineup [OpenKattis]
1 parent a11c304 commit d09807f

File tree

4 files changed

+36
-0
lines changed

4 files changed

+36
-0
lines changed

‎OpenKattis/lineup/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<img src="problem.png" />

‎OpenKattis/lineup/problem.png‎

185 KB
Loading[フレーム]

‎OpenKattis/lineup/solution.cpp‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include<bits/stdc++.h>
2+
3+
using namespace std;
4+
5+
int main(){
6+
#define int long long
7+
int n; cin >> n;
8+
string arr[n+9];
9+
for(int i = 0; i < n; i++) cin >> arr[i];
10+
11+
bool inc = false;
12+
bool dec = false;
13+
for(int i = 1; i < n; i++){
14+
if (arr[i] >= arr[i-1]) {
15+
inc = true;
16+
} else {
17+
dec = true;
18+
}
19+
}
20+
if (inc && dec) cout << "NEITHER\n";
21+
else if (inc) cout << "INCREASING\n";
22+
else cout << "DECREASING\n";
23+
}
24+

‎OpenKattis/lineup/solution.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
l = []
2+
for i in range(int(input())):
3+
l.append(input())
4+
if l == sorted(l):
5+
print("INCREASING")
6+
elif l == sorted(l , reverse=True):
7+
print("DECREASING")
8+
else:
9+
print("NEITHER")
10+
11+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /