답안 #851899

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
851899 2023-09-20T18:58:18 Z vjudge1 Osumnjičeni (COCI21_osumnjiceni) C++17
0 / 110
2 ms 600 KB
//author:
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

//#define ONLINE_JUDGE

void solve() {
    int n;
    cin >> n;

    vector <pair <int, int>> vec(n +1);
    for(int i = 1; i <= n; i++) {
        cin >> vec[i].first >> vec[i].second;
    }

    map <int, int> mp;
    for(int i = 1; i <= n; i++)
        mp[vec[i].first] = mp[vec[i].second] = 0;

    int cnt = 0;
    for(auto &[a, b] : mp)
        b = cnt++;

    for(int i = 1; i <= n; i++)
        vec[i].first = mp[vec[i].first], vec[i].second = mp[vec[i].second];

    vector <int> pref(cnt + 5);
    for(int i = 1; i <= n; i++) {
        pref[vec[i].first]++;
        pref[vec[i].second +1]--;
    }

    vector <int> arr = pref;
    for(int i = 1; i <= cnt + 4; i++)
        arr[i] += arr[i -1];

    /*
    for(int &i : arr)
        cerr << i << " ";
    */

    cout << *max_element(arr.begin(), arr.end());

    int q;
    cin >> q;
    for(int i = 1; i <= q; i++) {
        int l, r;
        cin >> l >> r;


    }
    
    return;
}

signed main() {
    #ifndef ONLINE_JUDGE
        freopen(".in", "r", stdin);
        freopen(".out", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t = 1; //cin >> t;
    while(t--)
        solve();

    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:59:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   59 |         freopen(".in", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~
Main.cpp:60:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   60 |         freopen(".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -