Submission #1074590

#TimeUsernameProblemLanguageResultExecution timeMemory
1074590NoLoveExhibition (JOI19_ho_t2)C++14
100 / 100
49 ms5856 KiB
/** * author : Lăng Trọng Đạt * created: 2024-08-25 **/ #include <bits/stdc++.h> using namespace std; #ifndef LANG_DAT #define db(...) ; #endif // LANG_DAT #define int long long #define mp make_pair #define f first #define se second #define pb push_back #define all(v) (v).begin(), (v).end() using pii = pair<int, int>; using vi = vector<int>; #define FOR(i, a, b) for (int i = a; (i) <= (b); i++) void mx(int& a, int b) { if (b > a) a = b; } void mi(int& a, int b) { if (b < a) a = b; } #define si(x) (int)(x.size()) const int INF = 1e18; const int MOD = 1e9 + 7; const int N = 1e5 + 5; int w[N]; int n, m, k, a, b; vector<pii> pic; int32_t main() { cin.tie(0)->sync_with_stdio(0); if (fopen("hi.inp", "r")) { freopen("hi.inp", "r", stdin); // freopen("hi.out", "w", stdout); } cin >> n >> m; pic.resize(n); for (auto&[v, s] : pic) cin >> s >> v; FOR(i, 1, m) { cin >> w[i]; } db(pic) sort(all(pic), greater<pii>()); sort(w + 1, w + m + 1, greater<int>()); int ans = 0, pos = 0; FOR(i, 1, m) { db(pos, pic[pos], w[i]) while (pos < n && pic[pos].se > w[i]) pos++; if (pos == n) break; pos++; ans++; } cout << ans; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int32_t main()':
joi2019_ho_t2.cpp:40:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   40 |     for (auto&[v, s] : pic) cin >> s >> v;
      |               ^
joi2019_ho_t2.cpp:34:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |         freopen("hi.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...