답안 #366256

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
366256 2021-02-13T16:57:19 Z Killer2501 Exhibition (JOI19_ho_t2) C++14
0 / 100
17 ms 23916 KB
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define task "deleg"
#define pll pair<ll, ll>
#define pii pair<ll, pll>
#define fi first
#define se second
#define ull unsigned long long
using namespace std;
const ll mod = 1e15+7;
const ll N = 3e5+5;
const ll M = 1e6+5;
vector<ll> adj[N], sub[N];
vector<ll> kq;
ll n, m, t, k, b[N],  lab[N], u, v, h[N], a[N], ans, tong, d[N];
string s[N];
pll p[N];
void sol()
{
    cin >> n >> m;
    for(int i = 1; i <= n; i ++)cin >> p[i].se >> p[i].fi;
    for(int j = 1; j <= m; j ++)cin >> b[j];
    sort(p+1, p+1+n);
    sort(b+1, b+1+m);
    int j = n;
    for(int i = m; i > 0; i --)
    {
        if(b[i] >= p[j].se && j > 0)
        {
            --j;
            ++ans;
        }
    }
    cout << ans;
}
int main()
{
    if(fopen(task".in", "r")){
       freopen(task".in", "r", stdin);
       freopen(task".out", "w", stdout);
    }
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int ntest = 1;
    //cin >> ntest;
    while(ntest -- > 0)
    sol();
}
// 8 5 3420
// 100000 666 505047023

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:40:15: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   40 |        freopen(task".in", "r", stdin);
      |        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:41:15: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   41 |        freopen(task".out", "w", stdout);
      |        ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 23788 KB Output is correct
2 Correct 15 ms 23788 KB Output is correct
3 Correct 16 ms 23788 KB Output is correct
4 Correct 15 ms 23788 KB Output is correct
5 Correct 17 ms 23788 KB Output is correct
6 Correct 15 ms 23788 KB Output is correct
7 Incorrect 15 ms 23916 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 23788 KB Output is correct
2 Correct 15 ms 23788 KB Output is correct
3 Correct 16 ms 23788 KB Output is correct
4 Correct 15 ms 23788 KB Output is correct
5 Correct 17 ms 23788 KB Output is correct
6 Correct 15 ms 23788 KB Output is correct
7 Incorrect 15 ms 23916 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 23788 KB Output is correct
2 Correct 15 ms 23788 KB Output is correct
3 Correct 16 ms 23788 KB Output is correct
4 Correct 15 ms 23788 KB Output is correct
5 Correct 17 ms 23788 KB Output is correct
6 Correct 15 ms 23788 KB Output is correct
7 Incorrect 15 ms 23916 KB Output isn't correct
8 Halted 0 ms 0 KB -