Submission #369339

#TimeUsernameProblemLanguageResultExecution timeMemory
369339parsabahramiExhibition (JOI19_ho_t2)C++17
100 / 100
81 ms4864 KiB
// Call my Name and Save me from The Dark #include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef pair<int, int> pii; #define SZ(x) (int) x.size() #define F first #define S second const int N = 1e5 + 10, MOD = 1e9 + 7; int ret, n, m, S[N], V[N], id[N], C[N]; int main() { scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) { scanf("%d%d", &S[i], &V[i]), id[i] = i; } sort(id + 1, id + n + 1, [&] (int i, int j) { return V[i] != V[j] ? V[i] < V[j] : S[i] < S[j]; }); for (int i = 1; i <= m; i++) scanf("%d", &C[i]); sort(C + 1, C + m + 1); for (int i = m, ptr = n; i >= 1; i--) { if (ptr <= 0) break; while (S[id[ptr]] > C[i]) ptr--; if (ptr && S[id[ptr--]] <= C[i]) ret++; } printf("%d\n", ret); return 0; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |     scanf("%d%d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:19:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   19 |         scanf("%d%d", &S[i], &V[i]), id[i] = i;
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   23 |         scanf("%d", &C[i]);
      |         ~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...