This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <vector>
using namespace std;
const int N = 20000 + 10;
vector<pair<int,int>> vec[N], num[N];
int sp[N][3];
int passed[N];
int acc[N];
int finish[N];
int main(){
int n,M;
cin>>n;
for (int i=1;i<=n;i++){
for (int j : {0, 1, 2})
cin>>sp[i][j];
vec[sp[i][0]].push_back({i, 1});
}
cin>>M;
for (int i=1, a;i<=M;i++){
cin>>a;
acc[a] = 1;
}
for (int sec=1;sec<=15000;sec++){
for (auto [i,m] : vec[sec]){
if (m == 300){
finish[i] = sec;
passed[m]++;
continue;
}
if (acc[m] and passed[m] % 20 != 0){
int k = min(300 - m, passed[m] % 20);
vec[sec + k].push_back({i, m + k});
for (int j=0;j<k;j++)
num[sec + j].push_back({m + j, 0});
continue;
}
vec[sec + sp[i][m / 100]].push_back({i, m + 1});
num[sec].push_back({m, 0});
}
for (auto [m, zero] : num[sec])
passed[m]++;
}
for (int i=1;i<=n;i++)
cout<<finish[i]<<'\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |