답안 #1041512

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1041512 2024-08-02T05:01:45 Z vjudge1 Segway (COI19_segway) C++17
0 / 100
0 ms 348 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define pf push_front
#define ep emplace_back
#define ef emplace_front
#define len(a) *(&a+1)-a  
#define int long long
#define ld long double
#define mod 100000000007
#define stoi stoll
#define all(ls) ls.begin(),ls.end()
#define allr(ls) ls.rbegin(),ls.rend()
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2")
 
using namespace std;

using namespace __gnu_pbds;

template<typename type>using ordered_set=tree<type,null_type,less<type>,rb_tree_tag,tree_order_statistics_node_update>;
template<typename type>using ordered_multiset=tree<type,null_type,less_equal<type>,rb_tree_tag,tree_order_statistics_node_update>;

struct custom_hash{
	static uint64_t splitmix64(uint64_t x){
		x+=0x9e3779b97f4a7c15;
		x=(x^(x>>30))*0xbf58476d1ce4e5b9;
		x=(x^(x>>27))*0x94d049bb133111eb;
		return x^(x>>31);
	}
	size_t operator()(uint64_t x) const{
		static const uint64_t FIXED_RAnDOM=chrono::steady_clock::now().time_since_epoch().count();
		return splitmix64(x+FIXED_RAnDOM);
	}
};

int calc(int a,int b,int c,int curr){
	int ans=0;
	if(curr){
		ans+=min(curr,100LL)*a;
		curr-=min(curr,100LL);
	}
	if(curr){
		ans+=min(curr,100LL)*b;
		curr-=min(curr,100LL);
	}
	if(curr){
		ans+=min(curr,100LL)*c;
		curr-=min(curr,100LL);
	}
	return ans;
}

void solve(){
	int n;
	cin>>n;
	int ls[n][3];
	int boost[n];
	memset(boost,0,sizeof(boost));
	for(int i=0;i<n;i++)
		cin>>ls[i][0]>>ls[i][1]>>ls[i][2];	
	int m;
	cin>>m;
	for(int i=0;i<m;i++){
		int e;
		cin>>e;
		ordered_set<int>os;
		for(int j=0;j<n;j++){
			os.insert(-calc(ls[j][0],ls[j][1],ls[j][2],e));
		}
		for(int j=0;j<n;j++){
			int a=calc(ls[j][0],ls[j][1],ls[j][2],e);
			int k=os.size()-(os.order_of_key(-a)+1);
			boost[j]=k%20;
		}
	}
	for(int j=0;j<n;j++){
		int k=calc(ls[j][0],ls[j][1],ls[j][2],300);
		if(j!=n-1)
			cout<<k-boost[j]*4<<endl;
		else
			cout<<k-boost[j]*4;
	}
}

signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(nullptr); 
	cout.tie(nullptr);
	// freopen("talent.in","r",stdin);
	// freopen("talent.out","w",stdout);
	int t=1;
	// cin>>t;
	while(t--){
		solve();
	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -