답안 #832479

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
832479 2023-08-21T10:46:39 Z _martynas Inspections (NOI23_inspections) C++11
0 / 100
2000 ms 10904 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>

using namespace std;

const int mxn = 2e5+5;

int n, m, q;
int l[mxn], r[mxn], s[mxn], ans[mxn];

int main(int argc, char const *argv[]) {
    cin >> n >> m >> q;
    for(int i = 1; i <= m; i++) {
        cin >> l[i] >> r[i];
    }
    for(int i = 1; i <= q; i++) {
        cin >> s[i];
    }
    vector<int> order;
    for(int i = 1; i <= m; i++) {
        for(int j = l[i]; j <= r[i]; j++) {
            order.push_back(j);
        }
    }
    map<int, int> last, inc;
    for(int t = 0; t < (int)order.size(); t++) {
        if(last.find(order[t]) != last.end()) {
            // inc[t-last[order[t]]-1]++;
            for(int i = 1; i <= q; i++) {
                if(s[i] <= t-last[order[t]]-1) ans[i]++;
            }
        }
        last[order[t]] = t;
    }
    // vector<int> dec_s(q); iota(dec_s.begin(), dec_s.end(), 1);
    // sort(dec_s.begin(), dec_s.end(), [&](int i, int j) { return s[i] > s[j];});
    // int sum = 0;
    // auto it = inc.rbegin();
    // for(int i = 0; i < q; i++) {
    //     int j = dec_s[i];
    //     while(it != inc.rend() && it->first >= s[j]) {
    //         sum += it->second;
    //         it++;
    //     }
    //     ans[j] = sum;
    // }
    for(int i = 1; i <= q; i++) cout << ans[i] << " ";
    cout << "\n";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 22 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 22 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 35 ms 468 KB Output is correct
3 Execution timed out 2061 ms 10904 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 22 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 308 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Incorrect 22 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -