답안 #98035

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
98035 2019-02-20T01:45:39 Z dndhk Worst Reporter 2 (JOI16_worst_reporter2) C++14
0 / 100
3 ms 640 KB
#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;

const int MAX_N = 200000;

int N;
vector<pii> v1, v2;
vector<pair<pii, int> > v;
int cnt[MAX_N+1];
int ans;

int main(){
	scanf("%d", &N);
	ans = N;
	for(int i=0; i<N; i++){
		int a, b; scanf("%d%d", &a, &b);
		v.push_back({{b, a}, 0});
	}for(int i=0; i<N; i++){
		int a, b; scanf("%d%d", &a, &b);
		v.push_back({{b, a}, 1}); 
	}
	sort(v.begin(), v.end());
	for(int i=v.size()-1; i>=0; i--){
		pair<pii, int> now = v[i];
		if(now.second==1){
			cnt[now.first.second]++;
		}else{
			if(cnt[now.first.second]>0){
				cnt[now.first.second]--; ans--;
			}
		}
	}
	printf("%d", ans);
	return 0;
}

Compilation message

worst_reporter2.cpp: In function 'int main()':
worst_reporter2.cpp:15: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:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int a, b; scanf("%d%d", &a, &b);
             ~~~~~^~~~~~~~~~~~~~~~
worst_reporter2.cpp:21:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int a, b; scanf("%d%d", &a, &b);
             ~~~~~^~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 640 KB Output isn't correct
2 Halted 0 ms 0 KB -