답안 #159082

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
159082 2019-10-20T15:39:23 Z TadijaSebez Worst Reporter 2 (JOI16_worst_reporter2) C++11
0 / 100
2 ms 508 KB
#include <bits/stdc++.h>
using namespace std;
const int N=200050;
int a[N],b[N],c[N],d[N];
int main()
{
	int n;
	scanf("%i",&n);
	for(int i=1;i<=n;i++) scanf("%i %i",&a[i],&b[i]);
	for(int i=1;i<=n;i++) scanf("%i %i",&c[i],&d[i]);
	map<int,int> cnt;
	int all=0,ans=n;
	for(int i=n,j=n;i>=1;i--)
	{
		for(;j>=1 && b[j]<=d[i];j--)
		{
			cnt[a[j]]++;
			all++;
		}
		if(cnt[c[i]])
		{
			cnt[c[i]]--;
			ans--;
		}
		all--;
		if(all==0) cnt.clear();
	}
	printf("%i\n",ans);
	return 0;
}

Compilation message

worst_reporter2.cpp: In function 'int main()':
worst_reporter2.cpp:8:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i",&n);
  ~~~~~^~~~~~~~~
worst_reporter2.cpp:9:29: 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("%i %i",&a[i],&b[i]);
                        ~~~~~^~~~~~~~~~~~~~~~~~~~~
worst_reporter2.cpp:10:29: 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("%i %i",&c[i],&d[i]);
                        ~~~~~^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 508 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 508 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 508 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 508 KB Output is correct
2 Correct 2 ms 248 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Incorrect 2 ms 376 KB Output isn't correct
6 Halted 0 ms 0 KB -