제출 #641923

#제출 시각아이디문제언어결과실행 시간메모리
641923danikoynovExhibition (JOI19_ho_t2)C++14
100 / 100
151 ms1896 KiB
/** ____ ____ ____ ____ ____ ____ ||l |||e |||i |||n |||a |||d || ||__|||__|||__|||__|||__|||__|| |/__\|/__\|/__\|/__\|/__\|/__\| **/ #include<bits/stdc++.h> #define endl '\n' using namespace std; typedef long long ll; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } const int maxn = 1e5 + 10; struct picture { int s, v; }p[maxn]; bool cmp(picture p1, picture p2) { if (p1.v < p2.v) return true; if (p1.v > p2.v) return false; return p1.s < p2.s; } int n, m, c[maxn], used[maxn], dp[maxn]; void solve() { cin >> n >> m; for (int i = 1; i <= n; i ++) { cin >> p[i].s >> p[i].v; } for (int i = 1; i <= m; i ++) cin >> c[i]; sort(c + 1, c + m + 1); sort(p + 1, p + n + 1, cmp); ///cout << check(2) << endl; ///return; int ans = 0; c[m + 1] = 1e9 + 10; for (int i = n; i > 0; i --) { int mx = ans; int lf = 0, rf = ans + 1; while(lf <= rf) { int mf = (lf + rf) / 2; if (c[m - mf + 1] < p[i].s) rf = mf - 1; else lf = mf + 1; } dp[i] = rf; ans = max(ans, dp[i]); } cout << ans << endl; } int main() { solve(); return 0; } /** 10 10 978749728 144544247 765886828 382970504 724321206 775440108 793469869 329793955 744661733 757784475 737531928 772848949 880702330 298220471 886356598 234769581 756489712 541017091 976784156 205683907 498207927 462526472 688444509 591128229 744661733 421432475 299894333 737531928 39584784 724321206 */

컴파일 시 표준 에러 (stderr) 메시지

joi2019_ho_t2.cpp: In function 'void solve()':
joi2019_ho_t2.cpp:62:17: warning: unused variable 'mx' [-Wunused-variable]
   62 |             int mx = ans;
      |                 ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...