Submission #228924

#TimeUsernameProblemLanguageResultExecution timeMemory
228924PeppaPigExhibition (JOI19_ho_t2)C++14
100 / 100
78 ms4476 KiB
#include <bits/stdc++.h> #define pii pair<int, int> #define x first #define y second using namespace std; const int N = 1e5+5; int n, m, C[N]; pii A[N]; int main() { scanf("%d %d", &n, &m); for(int i = 1; i <= n; i++) scanf("%d %d", &A[i].y, &A[i].x); for(int i = 1; i <= m; i++) scanf("%d", C + i); sort(A + 1, A + n + 1, greater<pii>()); sort(C + 1, C + m + 1, greater<int>()); int ptr = 1, ans = 0; for(int i = 1; i <= m; i++) { while(ptr <= n && A[ptr].y > C[i]) ++ptr; if(ptr <= n) ++ans, ++ptr; } printf("%d\n", ans); return 0; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:15:10: 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:16:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= n; i++) scanf("%d %d", &A[i].y, &A[i].x);
                                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:17:38: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i <= m; i++) scanf("%d", C + i);
                                 ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...