QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#693663 | #6692. Building Company | ustcwaitme# | WA | 0ms | 3596kb | C++23 | 1.2kb | 2024-10-31 16:32:03 | 2024-10-31 16:32:03 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
typedef pair<int,int> PII;
const int N=1e5+10;
int g,n,res;
map<int,int> num;
map<int,priority_queue<PII,vector<PII>,greater<PII>>> st;
struct sb{
vector<int> a,b;
}add[N];
int op[N];
void upd (int x){
++res;
int len=add[x].a.size();
cout<<len<<endl;
for(int i=0;i<len;i++){
int a=add[x].a[i],b=add[x].b[i];
int& val=num[a];
val+=b;
priority_queue<PII,vector<PII>,greater<PII>>& q=st[a];
while(q.size()&&q.top().first<=val){
int pos=q.top().second;
q.pop();
if(--op[pos]==0){
upd(pos);
}
}
}
}
void solve(){
cin>>g;
for(int i=1;i<=g;i++){
int t,u;cin>>t>>u;
num[t]=u;
}
cin>>n;
for(int i=1;i<=n;i++){
int m;cin>>m;op[i]=m;
for(int j=1;j<=m;j++){
int a,b;cin>>a>>b;
if(num[a]>=b) --op[i];
else st[a].push({b,i});
}
int k;cin>>k;
add[i].a.resize(k);
add[i].b.resize(k);
for(int j=1;j<=k;j++){
int c,d;cin>>c>>d;
add[i].a[j-1]=c;
add[i].b[j-1]=d;
}
if(op[i]==0){
upd(i);
}
}
cout<<res<<endl;
}
signed main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3596kb
input:
2 2 1 1 2 5 1 3 1 0 2 1 1 2 1 2 3 2 2 1 3 1 5 2 3 3 4 1 2 5 3 2 1 1 1 3 4 1 1 3 0 1 3 2
output:
2 0 1 1 4
result:
wrong answer 1st numbers differ - expected: '4', found: '2'