이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
struct node{int pos, free, id;};
int n, m, ans[20005], cnt[305];
array<int, 3> arr[20005];
bool good[305]; vector<node> mp[305*55];
int main(){
cin.tie(0)->sync_with_stdio(0);
cin >> n;
for(int i = 0; i<n; ++i)
cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
cin >> m;
for(int i = 0; i<m; ++i){
int a; cin >> a;
good[a] = 1;
} cnt[0] = n;
for(int i = 0; i<n; ++i)
mp[arr[i][0]].push_back({1, 0, i});
for(int t = 0; t<305*55; ++t){
vector<int> todo;
for(auto [pos, free, id]:mp[t]){
todo.push_back(pos);
if(pos==300) ans[id] = t;
else if(free) mp[t+1].push_back({pos+1, free-1, id});
else if(!good[pos] || !(cnt[pos]%20)) mp[t+arr[id][pos/100]].push_back({pos+1, 0, id});
else mp[t+1].push_back({pos+1, (cnt[pos]%20)-1, id});
}
for(auto x : todo) ++cnt[x];
}
for(int i = 0; i<n; ++i)
cout << ans[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... |