제출 #467617

#제출 시각아이디문제언어결과실행 시간메모리
467617couplefireSegway (COI19_segway)C++17
100 / 100
218 ms88740 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...