This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
بسم الله الرحمن الرحيم
Author:
(:Muhammad Aneeq:)
*/
#include <iostream>
#include <queue>
#include <map>
#include <vector>
using namespace std;
int const M=400,N=2e4+10;
int sp[N]={};
bool acc[M]={};
inline void solve()
{
int n;
cin>>n;
int s[n][3];
for (auto& i:s)
cin>>i[0]>>i[1]>>i[2];
int m;
cin>>m;
for (int i=0;i<m;i++)
{
int x;cin>>x;acc[x-1]=1;
}
map<int,vector<int>>d,z;
for (int i=0;i<n;i++)
d[0].push_back(i);
for (int i=0;i<300;i++)
{
int cnt=0;
for (auto j:d)
{
for (auto k:j.second)
{
if (sp[k])
{
z[j.first+1].push_back(k);
sp[k]--;
}
else
{
z[j.first+s[k][i/100]].push_back(k);
if (acc[i])
{
sp[k]+=cnt%20;
}
}
}
cnt+=j.second.size();
}
d=z;
z.clear();
}
int ans[n]={};
for (auto i:d)
{
for(auto j:i.second)
ans[j]=i.first;
}
for (auto i:ans)
cout<<i<<endl;
}
int main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |