| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 122491 | kimbj0709 | Walking (NOI12_walking) | C++17 | 3 ms | 512 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}Compilation message (stderr)
| # | 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... | ||||
