QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#865398 | #6390. Inspections | earlyamazon | 0 | 307ms | 54504kb | C++14 | 1.6kb | 2025-01-21 17:41:52 | 2025-01-21 17:41:52 |
Judging History
answer
// pz3
// O(m^2 + )
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define st first
#define nd second
const int mn = 2e5+7;
const int oo = 1e18+7;
const int mxm = 4e6+7;
int n,m,q;
int l[mn], r[mn], s[mn], poms[mn];
set<int> wazne_ind;
vector<pair<pair<int,int>, int>> niezal;
map<int,int> odp;
int32_t main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin>>n>>m>>q;
wazne_ind.insert(1);
for (int i = 0; i < m; i++){
cin>>l[i]>>r[i];
wazne_ind.insert(l[i]);
if (r[i] != n) wazne_ind.insert(r[i]+1);
}
wazne_ind.insert(n+1);
for (auto i : wazne_ind){
if (i == n+1) break;
niezal.push_back({{i, (*next(wazne_ind.find(i)))-1}, oo});
}
int czas = 0;
vector<pair<int,int>> wyn;
for (int i = 0; i < m; i++){
for (int j = 0; j < (int)niezal.size(); j++){
int p = niezal[j].st.st;
int k = niezal[j].st.nd;
int t = niezal[j].nd;
if (p >= l[i] && k <= r[i]){
wyn.push_back({czas-t, k-p+1});
czas += k-p+1;
niezal[j].nd = czas;
}
}
}
for (int i = 0; i < q; i++){
cin>>s[i];
poms[i] = s[i];
}
sort(wyn.begin(), wyn.end(), greater<pair<int,int>>());
sort(poms, poms+q, greater<int>());
int wsk = 0;
int ter = 0;
for (int i = 0; i < q; i++){
while (wsk < (int)wyn.size() && wyn[wsk].st >= poms[i]){
ter += wyn[wsk++].nd;
}
odp[poms[i]] = ter;
}
for (int i = 0; i < q; i++){
cout<<odp[s[i]]<<" ";
}
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 7920kb
input:
20 20 10 3 16 8 17 17 18 6 16 7 7 3 19 8 13 4 15 5 7 1 18 17 18 3 13 1 10 6 10 2 8 11 18 1 14 9 18 3 16 4 15 8 2 17 19 12 15 7 17 4 3
output:
142 165 51 40 112 74 147 51 160 165
result:
wrong answer 1st lines differ - expected: '150 165 64 40 122 79 150 64 165 165', found: '142 165 51 40 112 74 147 51 160 165 '
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #18:
score: 0
Wrong Answer
time: 307ms
memory: 54504kb
input:
200000 2000 200000 1 120424 1 117468 1 120525 1 165913 1 120671 1 173649 1 177086 1 160439 1 113657 1 1024 1 172987 1 46445 1 141508 1 72552 1 166171 1 71764 1 129090 1 59615 1 157163 1 44185 1 24107 1 127434 1 157165 1 64831 1 2536 1 138854 1 96084 1 11803 1 162841 1 171842 1 116681 1 47063 1 65296...
output:
319 15786 0 319 185 185 0 4039 0 0 185 319 0 0 0 4039 8795 67453 0 1512 92833 0 0 0 4039 319 185 4039 319 0 0 0 7942 0 185 4039 0 9712 106453990 0 319 6437294 0 185 185 0 0 319 0 1448 1512 185 319 185 0 185 0 185 7169 0 319 0 185 1159434 37373 0 5258 185 0 0 1448 185 185 4039 0 0 0 0 0 0 0 185 0 0 3...
result:
wrong answer 1st lines differ - expected: '319 15786 0 319 185 185 0 4039...2 0 185 0 319 140410 0 185 4039', found: '319 15786 0 319 185 185 0 4039... 0 185 0 319 140410 0 185 4039 '
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%