답안 #367339

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
367339 2021-02-16T22:42:03 Z lookcook Exhibition (JOI19_ho_t2) Java 11
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>

#define int long long

using namespace std;

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, m;
    cin >> n >> m;
    map<pair<int,int>,int> cnt;
    vector<int> frames;
    for (int i = 0; i < n; i++) {
        int s, v;
        cin >> s >> v;
        cnt[{s,v}]++;
    }
    for (int i = 0; i < m; i++) {
        int c;
        cin >> c;
        frames.push_back(c);
    }
    sort(frames.begin(),frames.end());
    reverse(frames.begin(),frames.end());
    int lstVal = 1e18;
    int res = 0;
    for (int i = 0; i < frames.size(); i++) {
        int c = frames[i];
        pair<int,int> best = {-1,-1};
        for (pair<pair<int,int>,int> pa : cnt) {
            if (pa.first.second <= lstVal && pa.first.first <= c) {
                if (pa.first.second>=best.second) best = pa.first;
            }
        }
        if (best.first != -1) {
            res++;
            lstVal = best.second;
            cnt[best]--;
            if (cnt[best] == 0) cnt.erase(best);
        }
    }
    cout << res << '\n';
}

Compilation message

joi2019_ho_t2.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
joi2019_ho_t2.java:1: error: class, interface, or enum expected
#include <bits/stdc++.h>
         ^
joi2019_ho_t2.java:3: error: illegal character: '#'
#define int long long
^
joi2019_ho_t2.java:7: error: class, interface, or enum expected
signed main() {
^
joi2019_ho_t2.java:9: error: class, interface, or enum expected
    cin.tie(0);
    ^
joi2019_ho_t2.java:10: error: class, interface, or enum expected
    int n, m;
    ^
joi2019_ho_t2.java:11: error: class, interface, or enum expected
    cin >> n >> m;
    ^
joi2019_ho_t2.java:12: error: class, interface, or enum expected
    map<pair<int,int>,int> cnt;
    ^
joi2019_ho_t2.java:13: error: class, interface, or enum expected
    vector<int> frames;
    ^
joi2019_ho_t2.java:14: error: class, interface, or enum expected
    for (int i = 0; i < n; i++) {
    ^
joi2019_ho_t2.java:14: error: class, interface, or enum expected
    for (int i = 0; i < n; i++) {
                    ^
joi2019_ho_t2.java:14: error: class, interface, or enum expected
    for (int i = 0; i < n; i++) {
                           ^
joi2019_ho_t2.java:16: error: class, interface, or enum expected
        cin >> s >> v;
        ^
joi2019_ho_t2.java:17: error: class, interface, or enum expected
        cnt[{s,v}]++;
        ^
joi2019_ho_t2.java:18: error: class, interface, or enum expected
    }
    ^
joi2019_ho_t2.java:19: error: class, interface, or enum expected
    for (int i = 0; i < m; i++) {
                    ^
joi2019_ho_t2.java:19: error: class, interface, or enum expected
    for (int i = 0; i < m; i++) {
                           ^
joi2019_ho_t2.java:21: error: class, interface, or enum expected
        cin >> c;
        ^
joi2019_ho_t2.java:22: error: class, interface, or enum expected
        frames.push_back(c);
        ^
joi2019_ho_t2.java:23: error: class, interface, or enum expected
    }
    ^
joi2019_ho_t2.java:25: error: class, interface, or enum expected
    reverse(frames.begin(),frames.end());
    ^
joi2019_ho_t2.java:26: error: class, interface, or enum expected
    int lstVal = 1e18;
    ^
joi2019_ho_t2.java:27: error: class, interface, or enum expected
    int res = 0;
    ^
joi2019_ho_t2.java:28: error: class, interface, or enum expected
    for (int i = 0; i < frames.size(); i++) {
    ^
joi2019_ho_t2.java:28: error: class, interface, or enum expected
    for (int i = 0; i < frames.size(); i++) {
                    ^
joi2019_ho_t2.java:28: error: class, interface, or enum expected
    for (int i = 0; i < frames.size(); i++) {
                                       ^
joi2019_ho_t2.java:30: error: class, interface, or enum expected
        pair<int,int> best = {-1,-1};
        ^
joi2019_ho_t2.java:31: error: class, interface, or enum expected
        for (pair<pair<int,int>,int> pa : cnt) {
        ^
joi2019_ho_t2.java:34: error: class, interface, or enum expected
            }
            ^
joi2019_ho_t2.java:38: error: class, interface, or enum expected
            lstVal = best.second;
            ^
joi2019_ho_t2.java:39: error: class, interface, or enum expected
            cnt[best]--;
            ^
joi2019_ho_t2.java:40: error: class, interface, or enum expected
            if (cnt[best] == 0) cnt.erase(best);
            ^
joi2019_ho_t2.java:41: error: class, interface, or enum expected
        }
        ^
joi2019_ho_t2.java:44: error: class, interface, or enum expected
}
^
34 errors