Submission #366556

#TimeUsernameProblemLanguageResultExecution timeMemory
366556Tuk1352Exhibition (JOI19_ho_t2)C++11
100 / 100
171 ms5124 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n, m, p, s, v, I=0, k=0; cin >> n >> m; vector <int> P; vector <pair<int,int>> V; for (int i = 0; i < n; i++) { cin >> s >> v; V.push_back({v, s}); } for (int i = 0; i < m; i++) { cin >> p; P.push_back(p); } sort(V.rbegin(), V.rend()); sort(P.rbegin(), P.rend()); for (int i = 0; i < P.size(); i++) { while (I < V.size()) { if (V[I].second <= P[i]) { k++; break; } I++; } if (I == V.size()) { break; } I++; } cout << k; return 0; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:23:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for (int i = 0; i < P.size(); i++)
      |                     ~~^~~~~~~~~~
joi2019_ho_t2.cpp:25:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         while (I < V.size())
      |                ~~^~~~~~~~~~
joi2019_ho_t2.cpp:34:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |         if (I == V.size())
      |             ~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...