Submission #97385

#TimeUsernameProblemLanguageResultExecution timeMemory
97385BruteforcemanExhibition (JOI19_ho_t2)C++11
100 / 100
95 ms1572 KiB
#include "bits/stdc++.h" using namespace std; typedef pair <int, int> pii; pii a[100010]; int c[100010]; int opt[100010]; int main(int argc, char const *argv[]) { int n, m; scanf("%d %d", &n, &m); for(int i = 1; i <= n; i++) { scanf("%d %d", &a[i].second, &a[i].first); } for(int i = 1; i <= m; i++) { scanf("%d", &c[i]); } sort(a + 1, a + n + 1); sort(c + 1, c + m + 1); int cur = n; int ans = 0; for(int i = m; i >= 1; i--) { while(cur > 0 && a[cur].second > c[i]) { --cur; } if(cur > 0) { ++ans; --cur; } } printf("%d\n", ans); return 0; }

Compilation message (stderr)

joi2019_ho_t3.cpp: In function 'int main(int, const char**)':
joi2019_ho_t3.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t3.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &a[i].second, &a[i].first);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t3.cpp:16: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...