Submission #171285

#TimeUsernameProblemLanguageResultExecution timeMemory
171285dennisstarExhibition (JOI19_ho_t2)C++11
100 / 100
83 ms5352 KiB
#include <bits/stdc++.h> #define fi first #define se second #define ryan bear #define all(V) ((V).begin()), ((V).end()) using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef long double ld; typedef vector<int> vim; typedef vector<ll> vlm; int N, M; int S[100010], V[100010], C[100010]; pii ar[100010]; int main() { scanf("%d %d", &N, &M); for (int i=0; i<N; i++) { scanf("%d %d", &S[i], &V[i]); ar[i]={V[i], S[i]}; } for (int i=0; i<M; i++) scanf("%d", &C[i]); sort(ar, ar+N); sort(C, C+M); int ans=0; for (int i=M-1, j=N-1; i>=0; i--) { for (; j>=0; j--) if (ar[j].se<=C[i]) break; if (j>=0) ans++; j--; } printf("%d\n", ans); return 0; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:19: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_t2.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &S[i], &V[i]);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:24:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int i=0; 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...