QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#865831 | #6390. Inspections | earlyamazon | 0 | 586ms | 53180kb | C++14 | 1.8kb | 2025-01-21 23:57:04 | 2025-01-21 23:57:05 |
Judging History
answer
// pz3
// O(m^2*logm + q*logq)
#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});
}
// for (auto i : niezal){
// cout<<i.st.st<<" "<<i.st.nd<<" "<<i.nd<<"\n";
// }
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});
cout<<wyn.back().st<<" "<<wyn.back().nd<<" "<<i<<"xd\n";
niezal[j].nd = czas;
czas += k-p+1;
}
}
}
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]]<<" ";
}
}
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: 7872kb
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:
-1000000000000000000 1 0xd -999999999999999999 1 0xd -999999999999999998 1 0xd -999999999999999997 1 0xd -999999999999999996 1 0xd -999999999999999995 1 0xd -999999999999999994 2 0xd -999999999999999992 3 0xd -999999999999999989 1 0xd -999999999999999988 1 0xd -999999999999999987 1 0xd 9 1 1xd 9 2 1...
result:
wrong answer 1st lines differ - expected: '150 165 64 40 122 79 150 64 165 165', found: '-1000000000000000000 1 0xd'
Subtask #2:
score: 0
Skipped
Dependency #1:
0%
Subtask #3:
score: 0
Wrong Answer
Test #18:
score: 0
Wrong Answer
time: 586ms
memory: 53180kb
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:
-1000000000000000000 47 0xd -999999999999999953 297 0xd -999999999999999656 81 0xd -999999999999999575 110 0xd -999999999999999465 48 0xd -999999999999999417 26 0xd -999999999999999391 147 0xd -999999999999999244 268 0xd -999999999999998976 54 0xd -999999999999998922 49 0xd -999999999999998873 100 0...
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: '-1000000000000000000 47 0xd'
Subtask #4:
score: 0
Skipped
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
0%