본문 바로가기
백준 문제 해설

백준 4589 Gnome Sequencing

by toomanysegtrees 2022. 11. 3.

산학협력 expo 이틀 차다 이제 내일 하루 남았다.... 힘내자

https://www.acmicpc.net/problem/4589

 

4589번: Gnome Sequencing

In the book All Creatures of Mythology, gnomes are kind, bearded creatures, while goblins tend to be bossy and simple-minded. The goblins like to harass the gnomes by making them line up in groups of three, ordered by the length of their beards. The gnomes

www.acmicpc.net

풀이

if, else로 풀게되는 문제이다. 

 

시간 복잡도 : $O(N)$

소요 시간 : 1분

아쉬운 점 : 힘내자

전체적인 감상 : 1년 전의 내가 이 문제를 보았다면 똑같은 코드를 짰을지 궁금해진다.

/* basic setup {{{ */
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define compress(x) sort(all(x)), x.erase(unique(all(x)), x.end())
#define fast_io ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef const int ci;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3f;
/*}}}*/

int main(){
	fast_io;
	int n, a, b, c;

	cin>>n;
	cout<<"Gnomes:\n";
	while(n--){
		cin>>a>>b>>c;
		if((a < b && b < c) || (a > b && b > c)){
			cout<<"Ordered\n";
		}
		else cout<<"Unordered\n";
	}

}

'백준 문제 해설' 카테고리의 다른 글

백준 24751 Betting  (0) 2022.11.08
백준 15749 Snow Boots  (0) 2022.11.06
백준 25704 출석 이벤트  (0) 2022.11.05
백준 18409 母音を数える (Counting Vowels)  (0) 2022.11.04
백준 23235 The Fastest Sorting Algorithm In The World  (0) 2022.11.02
백준 17356 욱 제  (0) 2022.11.01
백준 5524 입실 관리  (1) 2022.10.31
백준 20648 Rectangular Pasture  (0) 2022.10.30