Submission #1041510

# Submission time Handle Problem Language Result Execution time Memory
1041510 2024-08-02T04:58:18 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);
		cout<<k-boost[j]*4<<endl;
	}
	cout<<endl;
}

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();
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -