이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int length;
bool can(int a,int b,int c,int d){
//pos1,val,pos2,val
return (long double)(a+((long double)(length)/(long double)b))>(long double)(c+((long double)(length)/(long double)d));
}
int main() {
int no_of_input;
int input1,input2;
vector<pair<int,int> > vect1;
cin >> length >> no_of_input;
for(int i=0;i<no_of_input;i++){
cin >> input1 >> input2;
vect1.push_back({input1,input2});
}
sort(vect1.begin(),vect1.end());
vector<int> dp(no_of_input,1);
for(int i=0;i<no_of_input;i++){
for(int j=i+1;j<no_of_input;j++){
if(vect1[i].first<vect1[j].first){
if(can(vect1[i].first,vect1[i].second,vect1[j].first,vect1[j].second)==true){
//cout << i << " " << j << "\n";
//cout << vect1[i].first << " "<< vect1[j].first << "\n";
dp[j]= max(dp[j],dp[i]+1);
}
}
}
}
int maxx = 0;
for(int i=0;i<dp.size();i++){
//cout << dp[i] << " ";
maxx = max(maxx,dp[i]);
}
//cout << "\n";
cout << maxx;
}
컴파일 시 표준 에러 (stderr) 메시지
walking.cpp: In function 'int main()':
walking.cpp:34:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<dp.size();i++){
~^~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |