MY MEMO

[BAEKJOON] 10868 최소값 본문

ALGORITHM/BAEKJOON

[BAEKJOON] 10868 최소값

l_j_yeon 2017. 10. 5. 15:21
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    int n, quiz_count;
    scanf("%d %d", &n, &quiz_count);
    vector<pair<int,int>>num(n+1);
    for (int j = 1; j <= n; j++)
    {
        scanf("%d", &num[j].first);
        num[j].second = j;
    }
    sort(num.begin(), num.end());
    int start, end;
    for (int j = 0; j < quiz_count; j++)
    {
        scanf("%d %d", &start, &end);
         
        for (int j = 0; j < n; j++)
        {
            if (num[j].second >= start && num[j].second <= end)
            {
                printf("%d\n", num[j].first);
                break;
            }
        }
    }
    return 0;
}


화가 날땐 쉬운 문제를 풀고


맞았습니다!!가 뜨면 행복해진다..


:)

'ALGORITHM > BAEKJOON' 카테고리의 다른 글

[BAEKJOON] 5557 1학년  (0) 2017.10.08
[BAEKJOON 1822 차집합 (실패)  (0) 2017.10.05
[BAEKJOON] 10973 이전 순열  (0) 2017.10.05
[BAEKJOON] 10974 모든 순열  (0) 2017.10.05
[BAEKJOON] 2169 로봇 조종하기  (0) 2017.10.05