Submission #930359

#TimeUsernameProblemLanguageResultExecution timeMemory
930359panArcade (NOI20_arcade)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> //#include <ext/pb_ds/tree_policy.hpp> //#include "bits_stdc++.h" #define f first #define s second #define pb push_back #define mp make_pair #define lb lower_bound #define ub upper_bound #define input(x) scanf("%lld", &x); #define input2(x, y) scanf("%lld%lld", &x, &y); #define input3(x, y, z) scanf("%lld%lld%lld", &x, &y, &z); #define input4(x, y, z, a) scanf("%lld%lld%lld%lld", &x, &y, &z, &a); #define print(x, y) printf("%lld%c", x, y); #define show(x) cerr << #x << " is " << x << endl; #define show2(x,y) cerr << #x << " is " << x << " " << #y << " is " << y << endl; #define show3(x,y,z) cerr << #x << " is " << x << " " << #y << " is " << y << " " << #z << " is " << z << endl; #define discretize(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end()); using namespace std; //using namespace __gnu_pbds; #define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> #define ordered_multiset tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> typedef long long ll; typedef long double ld; typedef pair<ld, ll> pd; typedef pair<string, ll> psl; typedef pair<ll, ll> pi; typedef pair<ll, pi> pii; int main() { ll n, m; input2(n, m); vector<ll> t(m), a(m); vector<pi> op(m); for (ll i=0; i<m; ++i) input(t[i]); for (ll i=0; i<m; ++i) input(a[i]); for (ll i=0; i<m; ++i) {op[i].f = t[i]+a[i], op[i].s = a[i]-t[i];} sort(op.begin(), op.end()); vector<ll> lis; for (ll i=0; i<n; ++i) { ll ind = lb(lis.begin(), lis.end(), op[i].s)-lis.begin(); if (ind==lis.size()) lis.pb(op[i].s); else lis[ind] = op[i].s; } print((ll) lis.size(), '\n'); return 0; }

Compilation message (stderr)

Arcade.cpp: In function 'int main()':
Arcade.cpp:44:10: 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]
   44 |   if (ind==lis.size()) lis.pb(op[i].s);
      |       ~~~^~~~~~~~~~~~
Arcade.cpp:12:27: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 | #define input2(x, y) scanf("%lld%lld", &x, &y);
      |                      ~~~~~^~~~~~~~~~~~~~~~~~~~
Arcade.cpp:33:2: note: in expansion of macro 'input2'
   33 |  input2(n, m);
      |  ^~~~~~
Arcade.cpp:11:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | #define input(x) scanf("%lld", &x);
      |                  ~~~~~^~~~~~~~~~~~
Arcade.cpp:36:25: note: in expansion of macro 'input'
   36 |  for (ll i=0; i<m; ++i) input(t[i]);
      |                         ^~~~~
Arcade.cpp:11:23: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 | #define input(x) scanf("%lld", &x);
      |                  ~~~~~^~~~~~~~~~~~
Arcade.cpp:37:25: note: in expansion of macro 'input'
   37 |  for (ll i=0; i<m; ++i) input(a[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...