Submission #120139

#TimeUsernameProblemLanguageResultExecution timeMemory
120139antimirageExhibition (JOI19_ho_t2)C++14
100 / 100
124 ms6108 KiB
/** GOT A FEELING THAT I"M GOING UNDER **/ #include <bits/stdc++.h> #define fr first #define sc second #define mk make_pair #define pb push_back #define all(s) s.begin(), s.end() using namespace std; const int N = 1e5 + 5; int n, m, x, y, c[N], ans, last = 1e9 + 7; multiset < pair <int, int>, greater < pair <int, int> > > st; main(){ cin >> n >> m; for (int i = 1; i <= n; i++) { scanf("%d%d", &x, &y); st.insert( mk( y, x ) ); } for (int i = 1; i <= m; i++) { scanf("%d", &c[i]); } sort(c + 1, c + m + 1); for (int i = m; i >= 1; i--) { while (!st.empty() && st.begin()->sc > c[i]) st.erase(st.begin()); if (st.empty()) break; st.erase(st.begin()); ans++; } cout << ans << endl; }

Compilation message (stderr)

joi2019_ho_t2.cpp:20:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &x, &y);
   ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:28:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &c[i]);
   ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...