Submission #197517

#TimeUsernameProblemLanguageResultExecution timeMemory
197517handlenameWalking (NOI12_walking)C++17
25 / 25
3 ms504 KiB
#include <bits/stdc++.h> using namespace std; int lis(double arr[], int n) { int maxi = 0; int lis[n]; for (int i = 0; i < n; i++) lis[i] = 1; for (int i = 1; i < n; i++) for (int j = 0; j < i; j++) if (arr[i] > arr[j] && lis[i] < lis[j] + 1) lis[i] = lis[j] + 1; for (int i = 0; i < n; i++) maxi = max(maxi,lis[i]); return maxi; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); double l; int n; cin>>l>>n; vector<pair<double,double> > arr; //time,meeting? for (int i=0;i<n;i++){ double t,v; cin>>t>>v; arr.push_back(make_pair(t,(l/v + t))); } sort(arr.begin(),arr.end()); double brr[n]; for (int i=0;i<n;i++){ brr[i]=arr[n-1-i].second; } cout<<lis(brr,n); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...