Submission #834299

#TimeUsernameProblemLanguageResultExecution timeMemory
834299LiudasArcade (NOI20_arcade)C++17
100 / 100
389 ms6508 KiB
#include <vector> #include <iostream> #include <set> #include <algorithm> using namespace std; int main(){ int N, M; cin >> N >> M; vector<pair<int, int>> arr(M); for(int i = 0; i < M; i ++){ cin >> arr[i].first; } for(int i = 0; i < M; i ++){ cin >> arr[i].second; } for(int i = 0; i < M; i ++){ arr[i] = {arr[i].first + arr[i].second, arr[i].first - arr[i].second}; } sort(arr.rbegin(), arr.rend()); vector<int> ans; for(int i = 0; i < M; i ++){ int id = lower_bound(ans.begin(), ans.end(), arr[i].second)-ans.begin(); if(id == ans.size()){ ans.push_back(arr[i].second); } else{ ans[id] = arr[i].second; } } cout << ans.size() << endl; return 0; }

Compilation message (stderr)

Arcade.cpp: In function 'int main()':
Arcade.cpp:23:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         if(id == ans.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...
#Verdict Execution timeMemoryGrader output
Fetching results...