Submission #121053

# Submission time Handle Problem Language Result Execution time Memory
121053 2019-06-26T04:14:05 Z 이온조(#2969) Exhibition (JOI19_ho_t2) C++14
0 / 100
2 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

int S[100009], V[100009], C[100009];

int main() {
	int N, M; scanf("%d%d",&N,&M);
	for(int i=1; i<=N; i++) scanf("%d%d",&S[i],&V[i]);
	for(int i=1; i<=M; i++) scanf("%d",&C[i]);
	sort(C+1, C+M+1);
	vector<int> T;
	for(int i=1; i<=N; i++) {
		S[i] = lower_bound(C+1, C+M+1, S[i]) - C;
		if(S[i] <= M) T.push_back(i);
	}
	sort(T.begin(), T.end(), [&](int P, int Q) {
		if(V[P] == V[Q]) return S[P] > S[Q];
		return V[P] < V[Q];
	});
	int ans = 0;
	priority_queue<int> pq;
	for(int oi=0, s=0; oi<T.size(); oi++) {
		int i = T[oi]; ++s;
		ans = max(ans, s);
		pq.push(S[i] - oi);
		while(pq.size() && pq.top() == M - oi) {
			--s;
			pq.pop();
		}
	}
	printf("%d", ans);
	return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:22:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int oi=0, s=0; oi<T.size(); oi++) {
                     ~~^~~~~~~~~
joi2019_ho_t2.cpp:7:17: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int N, M; scanf("%d%d",&N,&M);
            ~~~~~^~~~~~~~~~~~~~
joi2019_ho_t2.cpp:8:31: 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",&S[i],&V[i]);
                          ~~~~~^~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:9:31: 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 time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -