QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#864518 | #6390. Inspections | earlyamazon | 0 | 0ms | 9952kb | C++14 | 923b | 2025-01-20 17:57:13 | 2025-01-20 17:57:17 |
answer
// pz2
// O(n*m + q)
#include <bits/stdc++.h>
using namespace std;
#define int long long
const int mn = 2e5+7;
const int oo = 1e18+7;
int n,m,q;
int l[mn], r[mn], s[mn];
int ost[mn];
int wyn[mn];
int32_t main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin>>n>>m>>q;
for (int i = 0; i < m; i++){
cin>>l[i]>>r[i];
}
for (int i = 0; i < q; i++){
cin>>s[i];
}
int ind = 0;
for (int j = 1; j <= n; j++){
ost[j] = oo;
}
for (int j = 0; j < m; j++){
for (int k = l[j]; k <= r[j]; k++){
// cerr<<k<<" ";
ind++;
if (ind - ost[k] > 0) wyn[ind-ost[k]-1]++;
ost[k] = ind;
}
}
for (int i = n*m; i >= 0; i--){
wyn[i] += wyn[i+1];
}
for (int i = 0; i < q; i++){
if (s[i] > n*m) cout<<"0 ";
else cout<<wyn[i]<<" ";
}
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 9952kb
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:
168 167 165 165 165 159 153 150 150 138
result:
wrong answer 1st lines differ - expected: '150 165 64 40 122 79 150 64 165 165', found: '168 167 165 165 165 159 153 150 150 138 '
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Runtime Error
Test #18:
score: 0
Runtime Error
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:
result:
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%