Submission #127616

#TimeUsernameProblemLanguageResultExecution timeMemory
127616IOrtroiiiExhibition (JOI19_ho_t2)C++14
100 / 100
87 ms2424 KiB
#include <bits/stdc++.h> using namespace std; const int N = 100100; int c[N]; pair<int, int> a[N]; int main() { 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); } int ans = 0; int ptr = n; sort(a + 1, a + n + 1); sort(c + 1, c + m + 1); for (int i = m; i > 0; --i) { while (ptr > 0 && a[ptr].second > c[i]) { --ptr; } if (ptr) { ++ans; --ptr; } } printf("%d\n", ans); }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:12:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d %d", &n, &m);
    ~~~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:14:12: 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_t2.cpp:17:12: 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...