Submission #1041416

# Submission time Handle Problem Language Result Execution time Memory
1041416 2024-08-02T03:32:40 Z vjudge1 Segway (COI19_segway) C++17
100 / 100
155 ms 1792 KB
/*
بسم الله الرحمن الرحيم
Author:
                          (:Muhammad Aneeq:)
*/

#include <iostream>
#include <queue>
#include <map>
#include <vector>
using namespace std;
int const M=400,N=2e4+10;
int sp[N]={};
bool acc[M]={};
inline void solve()
{
	int n;
	cin>>n;
	int s[n][3];
	for (auto& i:s)
		cin>>i[0]>>i[1]>>i[2];
	int m;
	cin>>m;
	for (int i=0;i<m;i++)
	{
		int x;cin>>x;acc[x]=1;
	}
	map<int,vector<int>>d,z;
	for (int i=0;i<n;i++)
		d[0].push_back(i);
	for (int i=0;i<300;i++)
	{
		int cnt=0;
		for (auto j:d)
		{
			for (auto k:j.second)
			{
				if (acc[i]&&!sp[k])
				{
					sp[k]+=cnt%20;
				}
				if (sp[k])
				{
					z[j.first+1].push_back(k);
					sp[k]--;
				}
				else
				{
					z[j.first+s[k][i/100]].push_back(k);
				}
			}
			cnt+=j.second.size();
		}
			d=z;
			z.clear();
	}
	int ans[n]={};
	for (auto i:d)
	{
		for(auto j:i.second)
			ans[j]=i.first;
	}
	for (auto i:ans)
		cout<<i<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
        solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 5 ms 600 KB Output is correct
3 Correct 18 ms 596 KB Output is correct
4 Correct 66 ms 848 KB Output is correct
5 Correct 151 ms 1792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 5 ms 344 KB Output is correct
9 Correct 7 ms 348 KB Output is correct
10 Correct 8 ms 460 KB Output is correct
11 Correct 5 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 5 ms 600 KB Output is correct
3 Correct 18 ms 596 KB Output is correct
4 Correct 66 ms 848 KB Output is correct
5 Correct 151 ms 1792 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 2 ms 348 KB Output is correct
12 Correct 2 ms 468 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Correct 7 ms 348 KB Output is correct
15 Correct 8 ms 460 KB Output is correct
16 Correct 5 ms 344 KB Output is correct
17 Correct 25 ms 604 KB Output is correct
18 Correct 19 ms 600 KB Output is correct
19 Correct 91 ms 1104 KB Output is correct
20 Correct 155 ms 1428 KB Output is correct
21 Correct 132 ms 1368 KB Output is correct
22 Correct 122 ms 1612 KB Output is correct
23 Correct 74 ms 1244 KB Output is correct