답안 #676283

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
676283 2022-12-30T06:29:48 Z Do_you_copy Exhibition (JOI19_ho_t2) C++17
100 / 100
49 ms 2352 KB
//Then
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define faster ios_base::sync_with_stdio(0); cin.tie(0);

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair <int, int>;
mt19937_64 Rand(chrono::steady_clock::now().time_since_epoch().count());
const int maxN = 1e5 + 1;
//const int Mod = 1e9 + 7;
//const int inf =
int n, m;
pii a[maxN];
int c[maxN];
void Init(){
    cin >> n >> m;
    for (int i = 1; i <= n; ++i){
        cin >> a[i].fi >> a[i].se;
        swap(a[i].fi, a[i].se);
    }
    for (int i = 1; i <= m; ++i) cin >> c[i];
    sort(c + 1, c + m + 1);
    sort(a + 1, a + n + 1);
    int j = n;
    int ans = 0;
    for (int i = m; i >= 1; --i){
        while (j > 0 && a[j].se > c[i]) --j;
        if (j == 0) break;
        ++ans;
        --j;
    }
    cout << ans;
}

#define debug
#define taskname "test"
signed main(){
    faster
    if (fopen(taskname".inp", "r")){
        freopen(taskname".inp", "r", stdin);
        freopen(taskname".out", "w", stdout);
    }
    int tt = 1;
    //cin >> tt;
    while (tt--){
        Init();
    }
    if (fopen("timeout.txt", "r")){
        ofstream timeout("timeout.txt");
        timeout << signed(double(clock()) / CLOCKS_PER_SEC * 1000);
        timeout.close();
        #ifndef debug
        cerr << "Time elapsed: " << signed(double(clock()) / CLOCKS_PER_SEC * 1000) << "ms\n";
        #endif // debug
    }
}

Compilation message

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:44:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   44 |         freopen(taskname".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:45:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |         freopen(taskname".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 368 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 336 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 332 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 332 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 368 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 340 KB Output is correct
35 Correct 1 ms 336 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 43 ms 2236 KB Output is correct
39 Correct 40 ms 2268 KB Output is correct
40 Correct 37 ms 2264 KB Output is correct
41 Correct 42 ms 2252 KB Output is correct
42 Correct 43 ms 2264 KB Output is correct
43 Correct 44 ms 2240 KB Output is correct
44 Correct 43 ms 2248 KB Output is correct
45 Correct 44 ms 2308 KB Output is correct
46 Correct 42 ms 2332 KB Output is correct
47 Correct 39 ms 2200 KB Output is correct
48 Correct 46 ms 2124 KB Output is correct
49 Correct 41 ms 2020 KB Output is correct
50 Correct 34 ms 2152 KB Output is correct
51 Correct 43 ms 2228 KB Output is correct
52 Correct 43 ms 2244 KB Output is correct
53 Correct 43 ms 2320 KB Output is correct
54 Correct 39 ms 2220 KB Output is correct
55 Correct 45 ms 2216 KB Output is correct
56 Correct 28 ms 1996 KB Output is correct
57 Correct 16 ms 1524 KB Output is correct
58 Correct 27 ms 1848 KB Output is correct
59 Correct 26 ms 1852 KB Output is correct
60 Correct 17 ms 1492 KB Output is correct
61 Correct 28 ms 1740 KB Output is correct
62 Correct 42 ms 2204 KB Output is correct
63 Correct 41 ms 2196 KB Output is correct
64 Correct 44 ms 2248 KB Output is correct
65 Correct 49 ms 2192 KB Output is correct
66 Correct 45 ms 2324 KB Output is correct
67 Correct 42 ms 2256 KB Output is correct
68 Correct 45 ms 2352 KB Output is correct
69 Correct 46 ms 2220 KB Output is correct
70 Correct 44 ms 2252 KB Output is correct
71 Correct 44 ms 2216 KB Output is correct
72 Correct 45 ms 2252 KB Output is correct
73 Correct 40 ms 2216 KB Output is correct