Submission #771838

#TimeUsernameProblemLanguageResultExecution timeMemory
771838RecursiveCoExhibition (JOI19_ho_t2)C++14
100 / 100
41 ms6600 KiB
// CF template, version 3.0

#include <bits/stdc++.h>

using namespace std;

#define improvePerformance ios_base::sync_with_stdio(false); cin.tie(0)
#define getTest int t; cin >> t
#define eachTest for (int _var=0;_var<t;_var++)
#define get(name) int (name); cin >> (name)
#define out(o) cout << (o)
#define getList(cnt, name) vector<int> (name); for (int _=0;_<(cnt);_++) { get(a); (name).push_back(a); }
#define sortl(name) sort((name).begin(), (name).end())
#define rev(name) reverse((name).begin(), (name).end())
#define forto(name, var) for (int (var) = 0; (var) < (name); (var)++)
#define decision(b) if (b){out("YES");}else{out("NO");}

#define int long long int

signed main() {
    improvePerformance;
    get(n);
    get(m);
    vector<pair<int, int>> photos;
    forto(n, i) {
        get(c);
        get(v);
        photos.push_back({v, c});
    }
    getList(m, frames);
    sortl(frames);
    sortl(photos);
    int ans = 0;
    int ptrp = n - 1;
    int ptrf = m - 1;
    while (ptrp >= 0 && ptrf >= 0) {
        while (ptrp >= 0 && photos[ptrp].second > frames[ptrf]) ptrp--;
        if (ptrp >= 0) ans++;
        ptrf--;
        ptrp--;
    }
    out(ans);
}

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:10:23: warning: unnecessary parentheses in declaration of 'n' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
joi2019_ho_t2.cpp:22:5: note: in expansion of macro 'get'
   22 |     get(n);
      |     ^~~
joi2019_ho_t2.cpp:10:23: warning: unnecessary parentheses in declaration of 'm' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
joi2019_ho_t2.cpp:23:5: note: in expansion of macro 'get'
   23 |     get(m);
      |     ^~~
joi2019_ho_t2.cpp:15:35: warning: unnecessary parentheses in declaration of 'i' [-Wparentheses]
   15 | #define forto(name, var) for (int (var) = 0; (var) < (name); (var)++)
      |                                   ^
joi2019_ho_t2.cpp:25:5: note: in expansion of macro 'forto'
   25 |     forto(n, i) {
      |     ^~~~~
joi2019_ho_t2.cpp:10:23: warning: unnecessary parentheses in declaration of 'c' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
joi2019_ho_t2.cpp:26:9: note: in expansion of macro 'get'
   26 |         get(c);
      |         ^~~
joi2019_ho_t2.cpp:10:23: warning: unnecessary parentheses in declaration of 'v' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
joi2019_ho_t2.cpp:27:9: note: in expansion of macro 'get'
   27 |         get(v);
      |         ^~~
joi2019_ho_t2.cpp:12:40: warning: unnecessary parentheses in declaration of 'frames' [-Wparentheses]
   12 | #define getList(cnt, name) vector<int> (name); for (int _=0;_<(cnt);_++) { get(a); (name).push_back(a); }
      |                                        ^
joi2019_ho_t2.cpp:30:5: note: in expansion of macro 'getList'
   30 |     getList(m, frames);
      |     ^~~~~~~
joi2019_ho_t2.cpp:10:23: warning: unnecessary parentheses in declaration of 'a' [-Wparentheses]
   10 | #define get(name) int (name); cin >> (name)
      |                       ^
joi2019_ho_t2.cpp:12:76: note: in expansion of macro 'get'
   12 | #define getList(cnt, name) vector<int> (name); for (int _=0;_<(cnt);_++) { get(a); (name).push_back(a); }
      |                                                                            ^~~
joi2019_ho_t2.cpp:30:5: note: in expansion of macro 'getList'
   30 |     getList(m, frames);
      |     ^~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...