# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
168551 |
2019-12-13T15:59:24 Z |
ahmet |
Segway (COI19_segway) |
C++14 |
|
12 ms |
1400 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i,n) for(long long (i)=0;(i)<(n);++(i))
#define ref(i,a,b) for (long long (i)=(a); (i)<=(b); ++(i))
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define mp make_pair
const int mx=3e4+5;
int a[mx],b[mx],c[mx],ans[mx];
int n,m,res[mx];
int main(){
/*freopen(".in", "r", stdin);
freopen(".out", "w", stdout);
*/ios_base::sync_with_stdio(false);cin.tie(NULL);
cin >> n;
rep(i,n){
cin >> a[i] >> b[i] >> c[i];
}
cin >> m;
vector <int > v;
priority_queue <pair <int,int> ,vector <pair <int,int > > ,greater <pair <int,int> >> pq;
rep(i,m){int xx;cin >> xx;v.pb(xx);}
for(int i=0;i<n;++i){
if(v[0]<100){
pq.push(mp(v[0]*a[i],i));
}
else if(v[0]<200){
pq.push(mp(a[i]*100+b[i]*(v[0]-99),i));
}
else
pq.push(mp(a[i]*100+b[i]*100+c[i]*(v[0]-199),i));
}
int say=0;
int onc=-1;
int ov=-1;
while(!pq.empty()){
int x=pq.top().second;
if(!pq.empty() and onc==pq.top().first)
ans[x]=ov;
else
ans[x]=say%20;
//cout << x << " " << say << endl;
++say;
onc=pq.top().first;
ov=ans[x];
pq.pop();
}
for(int i=0;i<n;++i){
if(v[0]<100){
if(ans[i]+v[0]<100){
res[i]=(b[i]+c[i])*100+(100-ans[i])*a[i]+ans[i];
}
else if(ans[i]+v[0]<200){
res[i]=c[i]*100+(v[0])*a[i]+(200-v[0]-ans[i])*b[i]+ans[i];
}
}
else if(v[0]<200){
if(ans[i]+v[0]<200){
res[i]=(a[i]+c[i])*100+(100-ans[i])*b[i]+ans[i];
}
else if(ans[i]+v[0]<300){
res[i]=a[i]*100+(v[0]-100)*b[i]+ans[i]+(300-v[0]-ans[i])*c[i];
}
}
else{
if(ans[i]+v[0]<300){
res[i]=(100-ans[i])*c[i]+(a[i]+b[i])*100+ans[i];
}
else{
res[i]=(v[0]-200)*c[i]+300-v[0]+(a[i]+b[i])*100;
}
}
}
rep(i,n){
cout << res[i] << endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
380 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
12 ms |
1400 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
380 KB |
Output is correct |
4 |
Correct |
3 ms |
504 KB |
Output is correct |
5 |
Correct |
12 ms |
1400 KB |
Output is correct |
6 |
Incorrect |
2 ms |
376 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |