# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1041520 |
2024-08-02T05:08:34 Z |
vjudge1 |
Segway (COI19_segway) |
C++17 |
|
610 ms |
1480 KB |
///~~~LOTA~~~///
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define append push_back
#define add insert
#define nl '\n'
#define ff first
#define ss second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(x) (x).begin(),(x).end()
#define L0TA ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define terminator main
#define N 20001
#define D 300
int M[D];
int O[D];
int ans[N];
int s[N][3];
priority_queue<pair<pii,pii>,vector<pair<pii,pii>>,greater<pair<pii,pii>>> Q;
void solve(){
int n,m,o,t,k,d,b;
cin>>n;
for(int i=1;i<=n;i++){
for(int j=0;j<3;j++)
cin>>s[i][j];
Q.push({{s[i][0],i},{1,0}});
}
vector<int> v;
cin>>m;
while(m--){
cin>>o;
M[o]=1;
}
m=0;
while(!Q.empty()){
t=Q.top().ff.ff;
k=Q.top().ff.ss;
d=Q.top().ss.ff;
b=Q.top().ss.ss;
Q.pop();
if(d==300){
ans[k]=t;
continue;
}
if(t>m){
m=t;
for(auto& i:v)
O[i]=(O[i]+1)%20;
v.clear();
}
v.append(d);
o=d/100;
o=s[k][o];
if(!b && M[d]) b=O[d];
if(b){
o=1;
b--;
}
Q.push({{t+o,k},{d+1,b}});
}
cout<<ans[1];
for(int i=2;i<=n;i++)
cout<<nl<<ans[i];
}
int terminator(){
//L0TA;
solve();
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
4 ms |
348 KB |
Output is correct |
3 |
Correct |
18 ms |
500 KB |
Output is correct |
4 |
Correct |
77 ms |
600 KB |
Output is correct |
5 |
Correct |
610 ms |
1288 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
344 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 |
452 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
2 ms |
348 KB |
Output is correct |
8 |
Correct |
4 ms |
456 KB |
Output is correct |
9 |
Correct |
5 ms |
460 KB |
Output is correct |
10 |
Correct |
7 ms |
348 KB |
Output is correct |
11 |
Correct |
5 ms |
456 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
4 ms |
348 KB |
Output is correct |
3 |
Correct |
18 ms |
500 KB |
Output is correct |
4 |
Correct |
77 ms |
600 KB |
Output is correct |
5 |
Correct |
610 ms |
1288 KB |
Output is correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
344 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 |
452 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
2 ms |
348 KB |
Output is correct |
13 |
Correct |
4 ms |
456 KB |
Output is correct |
14 |
Correct |
5 ms |
460 KB |
Output is correct |
15 |
Correct |
7 ms |
348 KB |
Output is correct |
16 |
Correct |
5 ms |
456 KB |
Output is correct |
17 |
Correct |
23 ms |
348 KB |
Output is correct |
18 |
Correct |
45 ms |
544 KB |
Output is correct |
19 |
Correct |
244 ms |
856 KB |
Output is correct |
20 |
Correct |
348 ms |
972 KB |
Output is correct |
21 |
Correct |
436 ms |
1232 KB |
Output is correct |
22 |
Correct |
593 ms |
1272 KB |
Output is correct |
23 |
Correct |
509 ms |
1480 KB |
Output is correct |