Submission #259681

# Submission time Handle Problem Language Result Execution time Memory
259681 2020-08-08T09:45:42 Z arnold518 None (JOI16_worst_reporter2) C++14
0 / 100
3 ms 4992 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int MAXN = 2e5;

int N;
pii A[MAXN+10], B[MAXN+10];
vector<int> V[MAXN+10];
int cnt[MAXN+10], P[MAXN+10];

int main()
{
	scanf("%d", &N);
	for(int i=1; i<=N; i++) scanf("%d%d", &A[i].second, &A[i].first);
	for(int i=1; i<=N; i++) scanf("%d%d", &B[i].second, &B[i].first);

	sort(A+1, A+N+1);
	sort(B+1, B+N+1);

	for(int i=1, j=1; i<=N; i++)
	{
		for(; j<=N && A[j].first<=B[i].first; j++) V[i].push_back(A[j].second);
		P[i]=B[i].second;
	}

	int ans=0;
	for(int i=1; i<=N; i++)
	{
		for(auto it : V[i]) cnt[it]++;
		if(cnt[P[i]]==0) continue;
		cnt[P[i]]--;
		ans++;
	}

	printf("%d\n", N-ans);
}

Compilation message

worst_reporter2.cpp: In function 'int main()':
worst_reporter2.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &N);
  ~~~~~^~~~~~~~~~
worst_reporter2.cpp:18: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", &A[i].second, &A[i].first);
                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
worst_reporter2.cpp:19: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", &B[i].second, &B[i].first);
                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4992 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4992 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4992 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 4992 KB Output isn't correct
2 Halted 0 ms 0 KB -