Submission #1033968

#TimeUsernameProblemLanguageResultExecution timeMemory
1033968vjudge1Exhibition (JOI19_ho_t2)C++17
0 / 100
1 ms4560 KiB
#include<bits/stdc++.h> #define ll long long #define pll pair<ll, ll> #define fi first #define se second using namespace std; int n, m; const int maxn = 2e6; const int inf = 1e9; pll p[maxn + 3]; ll c[maxn + 3], ans; bool vis[maxn + 3]; bool cmp(pll a, pll b) { if(a.se == b.se) return a.fi < b.fi; return a.se < b.se; } int main() { // freopen("EXHIBITION.INP", "r", stdin); // freopen("EXHIBITION.OUT", "w", stdout); ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m; for(int i = 1; i <= n; i++) { cin >> p[i].fi >> p[i].se; } sort(p + 1, p + n + 1, cmp); for(int i = 1; i <= m; i++) { cin >> c[i]; } sort(c + 1, c + n + 1); ll tmp = inf; for(int i = n; i >= 1; i--) { int l = 1, r = m, res = 0, mid = 0; while(l <= r) { mid = (l + r) / 2; if(c[mid] >= p[i].fi && !vis[mid] && tmp >= c[mid]) { l = mid + 1; res = mid; } else l = mid + 1; } if(res != 0) { ans ++; vis[res] == true; tmp = c[res]; } } cout << ans; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:56:22: warning: statement has no effect [-Wunused-value]
   56 |             vis[res] == true;
      |             ~~~~~~~~~^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...