이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int N = 20'000 + 10;
int n, sp[N][3], t[N], boost[N];
bool a[300];
int main()
{
cin >> n;
for(int i = 1; i <= n; i ++)
for(int j = 0; j < 3; j++)
cin >> sp[i][j];
int m;
cin >> m;
for(int i = 0; i < m; i ++)
{
int x;
cin >> x;
a[x] = true;
}
for(int d = 0; d < 300; d ++)
{
vector<pair<int,int> > st;
for(int i = 1; i <= n; i++)
st.push_back({t[i], i});
sort(st.begin(), st.end());
vector<int> ahead(n);
ahead[0] = 0;
for(int i = 1; i < n; i ++)
if(st[i].first == st[i - 1].first)
ahead[i] = ahead[i - 1];
else
ahead[i] = i % 20;
for(int i = 0; i < n; i ++)
{
int cur = st[i].second;
if(a[d] && !boost[cur])
boost[cur] = ahead[i];
if(boost[cur] > 0)
t[cur]++, boost[cur]--;
else
t[cur] += sp[cur][d / 100];
}
}
for(int i = 1; i <= n; i ++)
cout << t[i] << "\n";
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |