Submission #391658

#TimeUsernameProblemLanguageResultExecution timeMemory
391658maomao90Arcade (NOI20_arcade)C++14
100 / 100
215 ms8400 KiB
#include <bits/stdc++.h> using namespace std; #define mnto(x, y) x = min(x, (__typeof__(x)) y) #define mxto(x, y) x = max(x, (__typeof__(x)) y) #define REP(i, s, e) for (int i = s; i < e; i++) #define RREP(i, s, e) for (int i = s; i >= e; i--) typedef long long ll; typedef long double ld; #define MP make_pair #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; #define MT make_tuple typedef tuple<int, int, int> iii; #define ALL(_a) _a.begin(), _a.end() #define pb emplace_back typedef vector<int> vi; typedef vector<ii> vii; #define INF 1000000005 #define LINF 1000000000000000005 #define MOD 1000000007 #define MAXN 500005 int n, m; ii ta[MAXN], xy[MAXN]; vi lis; int main() { scanf("%d%d", &n, &m); REP (i, 0, m) { scanf("%d", &ta[i].FI); } REP (i, 0, m) { scanf("%d", &ta[i].SE); } REP (i, 0, m) { xy[i] = MP(ta[i].SE - ta[i].FI, ta[i].FI + ta[i].SE); } sort(xy, xy + m, [] (ii l, ii r) { if (l.FI == r.FI) return l.SE > r.SE; return l.FI < r.FI; }); REP (i, 0, m) { int upper = lower_bound(ALL(lis), xy[i].SE) - lis.begin(); if (upper == lis.size()) { lis.pb(xy[i].SE); } else { lis[upper] = xy[i].SE; } } printf("%d\n", (int) lis.size()); return 0; }

Compilation message (stderr)

Arcade.cpp: In function 'int main()':
Arcade.cpp:48:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |       if (upper == lis.size()) {
      |           ~~~~~~^~~~~~~~~~~~~
Arcade.cpp:32:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   32 |      scanf("%d%d", &n, &m);
      |      ~~~~~^~~~~~~~~~~~~~~~
Arcade.cpp:34:12: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   34 |       scanf("%d", &ta[i].FI);
      |       ~~~~~^~~~~~~~~~~~~~~~~
Arcade.cpp:37:12: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   37 |       scanf("%d", &ta[i].SE);
      |       ~~~~~^~~~~~~~~~~~~~~~~
#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...