Submission #1344873

#TimeUsernameProblemLanguageResultExecution timeMemory
1344873nagorn_phInspections (NOI23_inspections)C++20
0 / 100
1033 ms1114112 KiB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define ordered_set <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ordered_multiset <int, null_type, less_equal <int>, rb_tree_tag, tree_order_statistics_node_update>

#define int long long
#define double long double
#define pii pair <int, int>
#define tiii tuple <int, int, int>
#define tiiii tuple <int, int, int, int>
#define emb emplace_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define iShowSpeed cin.tie(NULL)->sync_with_stdio(false)
#define matrix vector <vector <int>>
#define mat(n, m) vector <vector <int>> (n, vector <int> (m));

const int mod = 1e9 + 7;
const int inf = 1e18;
const matrix II = {{1, 0}, {0, 1}};
const int N = 2e5 + 5;

void solve(){
    int n, m, q; cin >> n >> m >> q;
    vector <int> a(1);
    for (int i = 1; i <= m; i++) {
        int l, r; cin >> l >> r;
        for (int j = l; j <= r; j++) {
            a.emb(j);
        }
    }
    vector <int> prev(n + 1);
    vector <int> ans(4000005);
    for (int i = 1; i < a.size(); i++) {
        if (prev[a[i]] == 0) {
            prev[a[i]] = i;
            continue;
        }
        ans[i - prev[a[i]] - 1]++;
        prev[a[i]] = i;
    }
    for (int i = 4000000; i >= 0; i--) {
        ans[i] += ans[i + 1];
    }
    while (q--) {
        int x; cin >> x;
        cout << ans[x] << " ";
    }
}

int32_t main(){
    iShowSpeed;
    // int q; cin >> q; while (q--) 
    solve();
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...