답안 #168187

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
168187 2019-12-11T21:24:03 Z ahmet Segway (COI19_segway) C++14
0 / 100
2 ms 376 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;
	while(!pq.empty()){
		int x=pq.top().second;
		ans[x]=say;
		++say;
		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+(a[i]-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(ans[i]+v[0]<300){
				res[i]=(v[0])*a[i]+(300-v[0]-ans[i])*c[i]+ans[i];
			}
			else{
				res[i]=(v[0])*a[i]+300-v[0];
			}
		}	
		else if(v[0]<200){
			if(ans[i]+v[0]<200){
				res[i]=(a[i]+c[i])*100+(v[0]-100)*b[i]+(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{
				res[i]=(v[0]-100)*b[i]+300-v[0]+a[i]*100;
			}
		}
		else{
			if(ans[i]+v[0]<300){
				res[i]=(v[0]-200)*c[i]+(300-v[0]-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;
	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -