#include<bits/stdc++.h>
#define all(s) s.begin(),s.end()
using namespace std;
typedef int ll;
ll n,m,x,ans[20009],id[20009],a[20009][3],op[20009],p[309];
bool b[309];
vector<vector<ll> >v;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
v.resize(15009);
cin>>n;
for(ll i=0; i<n; i++)
for(ll j=0; j<3; j++)
cin>>a[i][j];
cin>>m;
for(ll i=0;i<m;i++)
{
cin>>x;
b[x]=1;
}
for(ll i=0;i<n;i++)
v[a[i][0]].push_back(i);
for(ll i=1;i<=15000;i++)
{
for(auto z:v[i])
{
id[z]++;
if(b[id[z]]&&op[z]==0){
op[z]=p[id[z]]%20;
}
if(id[z]==300)
ans[z]=i;
else
{
if(op[z])
op[z]--,v[i+1].push_back(z);
else
v[i+a[z][id[z]/100]].push_back(z);
}
}
for(auto z:v[i])
p[id[z]-1]++;
}
for(ll i=0;i<n;i++)
cout<<ans[i]<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
716 KB |
Output is correct |
2 |
Incorrect |
4 ms |
1100 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
768 KB |
Output is correct |
2 |
Correct |
1 ms |
716 KB |
Output is correct |
3 |
Incorrect |
1 ms |
716 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
716 KB |
Output is correct |
2 |
Incorrect |
4 ms |
1100 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |