이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
#define pb push_back
#define f first
#define s second
int main() {
int N, M;
cin >> N >> M;
vector<pi> pictures;
for (int i = 0; i < N; i++) {
int s, v;
cin >> s >> v;
pictures.pb({v, s});
}
vi frames;
for (int i = 0; i < M; i++) {
int s;
cin >> s;
frames.pb(s);
}
sort(pictures.begin(), pictures.end());
sort(frames.begin(), frames.end());
reverse(pictures.begin(), pictures.end());
reverse(frames.begin(), frames.end());
int nP = 0, ans = 0;
for (int i = 0; i < frames.size(); i++) {
while (nP < pictures.size() && pictures[nP].s > frames[i]) {
nP++;
}
if (nP == pictures.size()) {
break;
}
ans++;
nP++;
}
cout << ans << endl;
}
컴파일 시 표준 에러 (stderr) 메시지
joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:41:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < frames.size(); i++) {
~~^~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:42:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while (nP < pictures.size() && pictures[nP].s > frames[i]) {
~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:45:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (nP == pictures.size()) {
~~~^~~~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |