Submission #763353

#TimeUsernameProblemLanguageResultExecution timeMemory
763353giaminh2211Financial Report (JOI21_financial)C++14
5 / 100
121 ms6440 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; int d; // Function to find the length of the longest increasing subsequence int findLongestIncreasingSubsequence(const vector<int>& arr) { int n = arr.size(); vector<int> lis; for (int num : arr) { auto it = lower_bound(lis.begin(), lis.end(), num); if (it == lis.end()) { lis.push_back(num); } else { *it = num; } } return lis.size(); } int main() { int n; cin >> n >> d; vector<int> arr(n); for (int i = 0; i < n; i++) { cin >> arr[i]; } int length = findLongestIncreasingSubsequence(arr); cout << length << endl; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int findLongestIncreasingSubsequence(const std::vector<int>&)':
Main.cpp:10:9: warning: unused variable 'n' [-Wunused-variable]
   10 |     int n = arr.size();
      |         ^
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...