Submission #284857

#TimeUsernameProblemLanguageResultExecution timeMemory
2848573zpArcade (NOI20_arcade)C++14
100 / 100
337 ms9948 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; int x[500009],y[500009]; main(){ int m, n; vector<pair<int,int> > V; scanf("%d %d", &m, &n); for(int i = 1; i <= n; i++){ scanf("%d", &x[i]); } for(int i = 1; i <= n; i++){ scanf("%d", &y[i]); int u = x[i] + y[i]; int v = x[i] - y[i]; V.push_back({u, v}); } sort(V.begin(),V.end()); multiset<int> S; for(int i = 0; i < V.size(); i++){ int x = V[i].second; auto it = S.lower_bound(x+1); if(it == S.begin()){ S.insert(x); continue; } it--; S.erase(it); S.insert(x); } printf("%d", S.size()); }

Compilation message (stderr)

Arcade.cpp:5:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    5 | main(){
      |      ^
Arcade.cpp: In function 'int main()':
Arcade.cpp:20:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |     for(int i = 0; i < V.size(); i++){
      |                    ~~^~~~~~~~~~
Arcade.cpp:31:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::multiset<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   31 |     printf("%d", S.size());
      |             ~^   ~~~~~~~~
      |              |         |
      |              int       std::multiset<int>::size_type {aka long unsigned int}
      |             %ld
Arcade.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    8 |     scanf("%d %d", &m, &n);
      |     ~~~~~^~~~~~~~~~~~~~~~~
Arcade.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |         scanf("%d", &x[i]);
      |         ~~~~~^~~~~~~~~~~~~
Arcade.cpp:13:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   13 |         scanf("%d", &y[i]);
      |         ~~~~~^~~~~~~~~~~~~
#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...