SMALL
안녕하세요 오늘은 브루트 포스 알고리즘을 사용한 문제를 풀겠습니다.
#include <iostream>
#include <vector>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int N;
cin>>N;
vector<int> res(N, 1);
int arr[N][2];
for(int i = 0; i<N; i++){
cin>>arr[i][0]>>arr[i][1];
}
for(int i= 0; i<N;i++){
for(int j = 0; j<N; j++){
if(arr[i][0] < arr[j][0] and arr[i][1]< arr[j][1]){
res.at(i) ++;
}
}
}
for(int i = 0; i<N; i++){
cout<<res.at(i)<<" ";
}
}
LIST
'BOJ 문제풀이' 카테고리의 다른 글
백준 11650 c++ 풀이 (0) | 2021.08.02 |
---|---|
백준 1003번 c++ 풀이 (0) | 2021.08.01 |
백준 3053번 c++ 풀이 (0) | 2021.08.01 |
백준 4153번 c++ 풀이 (0) | 2021.08.01 |
백준 3009번 c++ 풀이 (0) | 2021.08.01 |