답안 #1097233

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1097233 2024-10-06T14:09:34 Z StefanSebez Exhibition (JOI19_ho_t2) C++14
0 / 100
0 ms 512 KB
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define ll long long
#define ld long double
int main(){
    int n,m;scanf("%i%i",&n,&m);
    pair<int,int>a[n+10];for(int i=1;i<=n;i++) scanf("%i%i",&a[i].fi,&a[i].se);
    int b[m+10]={0};for(int i=1;i<=m;i++) scanf("%i",&b[i]);
    sort(a+1,a+n+1,[&](pair<int,int>A,pair<int,int>B){return A.se<B.se;});
    sort(b+1,b+m+1);
    int res=0;
    //for(int i=1;i<=n;i++) printf("{%i %i} ",a[i].fi,a[i].se);printf("\n");
    for(int i=n,j=m;i>=1&&j>=1;i--){
		if(a[i].fi<=b[j]){
			res++;
			j--;
		}
    }
    printf("%i\n",res);
    return 0;
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:9:18: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     int n,m;scanf("%i%i",&n,&m);
      |             ~~~~~^~~~~~~~~~~~~~
joi2019_ho_t2.cpp:10:53: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |     pair<int,int>a[n+10];for(int i=1;i<=n;i++) scanf("%i%i",&a[i].fi,&a[i].se);
      |                                                ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:11:48: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     int b[m+10]={0};for(int i=1;i<=m;i++) scanf("%i",&b[i]);
      |                                           ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 512 KB Output is correct
3 Incorrect 0 ms 436 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 512 KB Output is correct
3 Incorrect 0 ms 436 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 512 KB Output is correct
3 Incorrect 0 ms 436 KB Output isn't correct
4 Halted 0 ms 0 KB -