답안 #129383

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
129383 2019-07-12T07:36:48 Z MrUnknown Exhibition (JOI19_ho_t2) C++11
0 / 100
2 ms 256 KB
/***
 *      __  __            _    _       _
 *     |  \/  |          | |  | |     | |
 *     | \  / |_ __      | |  | |_ __ | | ___ __   _____      ___ __
 *     | |\/| | '__|     | |  | | '_ \| |/ / '_ \ / _ \ \ /\ / / '_ \
 *     | |  | | |     _  | |__| | | | |   <| | | | (_) \ V  V /| | | |
 *     |_|  |_|_|    (_)  \____/|_| |_|_|\_\_| |_|\___/ \_/\_/ |_| |_|
 *
 *
***/
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,a,b) for (int i=a;i<=b;i++)
#define f_(i,a,b) for (int i=a;i>=b;i--)
#define MP make_pair
#define ii pair<int,int>
#define iii pair<int,ii>
#define fi first
#define se second
const ll mod=1000000007;

int n,m,pos=0,dem=0;
vector<ii> vp;
vector<int> vq;
int main() {
//	freopen("","r",stdin);
//	freopen("","w",stdout);
	scanf("%d %d", &n, &m);
	f(i,0,n-1) {
		int ui,vi;
		scanf("%d %d", &ui, &vi);
		vp.push_back(MP(vi,ui));
//		scanf("%d %d", &vp[i].se, &vp[i].fi);
	}
	f(j,1,m) {
		int xi;
		scanf("%d", &xi);
		vq.push_back(xi);
//		scanf("%d", &vq[j]);
	}
	sort(vp.begin(),vp.end());
	sort(vq.begin(),vq.end());
	f(i,0,n-1) {
		while (vq[pos]<vp[i].se&&pos<m) pos++;
		if (pos==m) break;
		dem++;
		pos++;
	}
	printf("%d", dem);
	return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:30:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:33:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &ui, &vi);
   ~~~~~^~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:39:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &xi);
   ~~~~~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Incorrect 2 ms 256 KB Output isn't correct
5 Halted 0 ms 0 KB -