Submission #753290

#TimeUsernameProblemLanguageResultExecution timeMemory
753290vjudge1Arcade (NOI20_arcade)C++98
100 / 100
423 ms24448 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll maxn=5e5+7; ll n, m, t[maxn], a[maxn]; vector <pair <ll, ll>> grid(maxn); int main(){ cin >> n >> m; for(int i=0; i<m; i++){ cin >> t[i]; } for(int i=0; i<m; i++){ cin >> a[i]; } for(int i=0; i<m; i++){ grid[i]=make_pair(a[i]+t[i], t[i]-a[i]); } sort(grid.rbegin(), grid.rend()); vector <ll> dp; for (int i = 0; i < m; ++i){ ll idx = lower_bound(dp.begin(), dp.end(), grid[i].second)-dp.begin(); if(idx==dp.size()) dp.push_back(grid[i].second); else dp[idx]=grid[i].second; } cout << dp.size() << endl; return 0; }

Compilation message (stderr)

Arcade.cpp: In function 'int main()':
Arcade.cpp:22:9: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |   if(idx==dp.size()) dp.push_back(grid[i].second);
      |      ~~~^~~~~~~~~~~
#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...