Submission #1023726

#TimeUsernameProblemLanguageResultExecution timeMemory
1023726trandangquangExhibition (JOI19_ho_t2)C++14
100 / 100
40 ms4528 KiB
#include <bits/stdc++.h> using namespace std; #define task "test" #define FOR(i, a, b) for(int i = (a); i <= (b); ++i) #define FORD(i, a, b) for(int i = (a); i >= (b); --i) #define sz(a) (int)(a).size() #define all(a) (a).begin(), (a).end() #define bit(s, i) (((s) >> (i)) & 1) #define ii pair <int, int> #define vii vector <ii> #define vi vector <int> #define fi first #define se second #define ll long long #define eb emplace_back #define pb push_back #define __builtin_popcount __builtin_popcountll void solve(); int32_t main() { if(fopen(task".inp", "r")) { freopen(task".inp", "r", stdin); freopen(task".out", "w", stdout); } cin.tie(0)->sync_with_stdio(0); int tc = 1; // cin >> tc; FOR(i, 1, tc) { solve(); } } const int N = 100100; int n, m, frame[N]; ii pic[N]; void solve() { cin >> n >> m; FOR(i, 1, n) cin >> pic[i].fi >> pic[i].se; FOR(i, 1, m) cin >> frame[i]; sort(pic+1, pic+1+n, [] (ii x, ii y) {return x.se < y.se || (x.se == y.se && x.fi < y.fi);}); sort(frame+1, frame+1+m); int pt1 = n, ans = 0; FORD(i, m, 1) { while(pic[pt1].fi > frame[i]) --pt1; if(pt1>0 && pic[pt1].fi <= frame[i]) { ++ans; --pt1; } } cout << ans; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int32_t main()':
joi2019_ho_t2.cpp:25:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |   freopen(task".inp", "r", stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:26:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |   freopen(task".out", "w", stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...