所有hack已过,求调
查看原帖
所有hack已过,求调
930325
Li_Yichen楼主2024/5/12 22:46
#include<bits/stdc++.h>
using namespace std;
//真的讨厌写大模拟,每次想写对都要写的跟AI一样,不熟悉用scanf调了一个小时,最后换回了cin,以此纪念我丧失在这道题上一天的时光 
//开题时间:2024/5/12 14:50
#define int long long
struct student{
	int gender;//性别 
	int grade;//专项成绩 
	int time;//长跑秒数 
	int flag;//是否通过体质检测 
	int last;//期末检测成绩 
	int times;//参加训练营次数 
	int able;//阳光运动合法 
	int tot;//总成绩 
	string level;//等级 
};
struct record{
	string date,id;
	int h1,m1,s1;
	int h2,m2,s2;
	double len;
	int m,s;
	int step;
}b[150005];
int cmp(record a,record b){
	if(a.h1 != b.h1) return a.h1 < b.h1;
	if(a.m1 != b.m1) return a.m1 < b.m1;
	return a.s1 < b.s2;
}
unordered_map<string,student> a;//存放每个学生的信息 
unordered_map<string,int> pret;
unordered_map<string,string> pred;
string name[10005];//名字 
int n,m;
int second(int m,int s){//转换到秒 
	return m * 60 + s;
}
int LongRun(int time,int gender){//长跑分数,传入的是秒数和性别 
	if(gender == 1){//男 
		if(time <= second(12,30)) return 20;
		if(time <= second(13,0)) return 18; 
		if(time <= second(13,30)) return 16;
		if(time <= second(14,0)) return 14;
		if(time <= second(14,30)) return 12;
		if(time <= second(15,10)) return 10;
		if(time <= second(15,50)) return 8;
		if(time <= second(16,30)) return 6;
		if(time <= second(17,10)) return 4;
		if(time <= second(18,0)) return 2;
		return 0;
	}else{//女 
		if(time <= second(6,40)) return 20;
		if(time <= second(6,57)) return 18; 
		if(time <= second(7,14)) return 16;
		if(time <= second(7,31)) return 14;
		if(time <= second(7,50)) return 12;
		if(time <= second(8,05)) return 10;
		if(time <= second(8,20)) return 8;
		if(time <= second(8,35)) return 6;
		if(time <= second(8,50)) return 4;
		if(time <= second(9,0)) return 2;
		return 0;
	}
} 
int Check_SunnyRun(int num,string date,string lastd,string id,int time,double len,int pause,int step,int gender,int last,int now){//查看健康跑步合不合法 
	if(gender == 0 && len * 1000.0 < 1500.0) return 0;
	if(gender == 1 && len * 1000.0 < 3000.0) return 0;
	//cout << len << " " << gender << " " << num << endl; 
	double avr_speed = (len * 1000.0 / time);
	if(avr_speed < 2.0 || avr_speed > 5.0) return 0;
	if(pause > second(4,30)) return 0;
	double avr_step = len * 1000.0 / step;
	if(avr_step > 1.5) return 0;
	int date1=0,date2=0;
	for(int i=0;i<date.size();i++){
		date1 *= 10;
		date1 += date[i] - '0';
	}
	for(int i=0;i<lastd.size();i++){
		date2 *= 10;
		date2 += lastd[i] - '0';
	}
	if(date2 - date1 > 1) return 1;
	if(date1 == date2 && now - last < 21600) return 0;
	if(date1 != date2 && 86400 - last + now < 21600) return 0;
	//cout << num << endl;
	return 1; 
}
int SunnyRun(int times){//计算阳光跑步分数 
	if(times >= 21) return 10;
	if(times >= 19) return 9;
	if(times >= 17) return 8;
	if(times >= 14) return 7;
	if(times >= 11) return 6;
	if(times >= 7) return 4;
	if(times >= 3) return 2;
	return 0;
}
int BodyExam(string id){//素质考试 
	if(a[id].flag) return 10;
	return 0;
}
int FinalTest(string id){//期末考试 
	return a[id].last;
}
int Attendance(int able,int times){//参与度 
	int cnt = able + times;
	if(cnt >= 18) return 5;
	if(cnt >= 15) return 4;
	if(cnt >= 12) return 3;
	if(cnt >= 9) return 2;
	if(cnt >= 6) return 1;
	return 0; 
}
string SetLevel(int tot){//设置等级 
	if(tot >= 95) return "A";
	if(tot >= 90) return "A-";
	if(tot >= 85) return "B+";
	if(tot >= 80) return "B";
	if(tot >= 77) return "B-";
	if(tot >= 73) return "C+";
	if(tot >= 70) return "C";
	if(tot >= 67) return "C-";
	if(tot >= 63) return "D+";
	if(tot >= 60) return "D";
	return "F";
} 
void Getin(){
	cin >> n;
	for(int i=1;i<=n;i++){
		string id;
		char gender;
		char passed;
		int m,s;
		char tmp;
		cin >> id;
		cin >> gender;
		cin >> a[id].grade;
		cin >> m >> tmp >> s >> tmp;
		cin >> passed;
		cin >> a[id].last >> a[id].times;
		if(gender == 'M') a[id].gender = 1;
		else a[id].gender = 0;
		if(passed == 'P') a[id].flag = 1;
		else a[id].flag = 0;
		a[id].time = second(m,s);
		name[i] = id;
	}
	sort(name+1,name+1+n);
	cin >> m;
	for(int i=1;i<=m;i++){
		string date,id;
		int h1,m1,s1;
		int h2,m2,s2;
		double len;
		int m,s;
		int step;
		char tmp;
		cin >> date >> id;
		cin >> h1 >> tmp >> m1 >> tmp >> s1;
		cin >> h2 >> tmp >> m2 >> tmp >> s2;
		cin >> len;
		cin >> m >> tmp >> s >> tmp;
		cin >> step;
		int gender = a[id].gender;
		int lastt;
		string lastd;
		if(!pret.count(id)) lastt = -1e5;
		else lastt = pret[id];
		if(!pred.count(id)) lastd = "0";
		else lastd = pred[id];
		int stay = second(m,s);
		int time = 0;
		if(m2 >= m1){
			if(s2 >= s1) time += second(m2-m1,s2-s1);
			else time += second(m2-1-m1,s2+60-s1);
		}else{
			h2 --;
			if(s2 >= s1) time += second(m2+60-m1,s2-s1);
			else time += second(m2+60-1-m1,s2+60-s1);
		}
		//cout << len << " " << i << endl;
		time += (h2 - h1) * 3600;
		int add = Check_SunnyRun(i,date,lastd,id,time,len,second(m,s),step,a[id].gender,lastt,h1*3600+second(m1,s1));
		if(add != 0){
			pret[id] = h2*3600+second(m2,s2);
			pred[id] = date;
		}
		a[id].able += add;
	}
}
void Output(){
	for(int i=1;i<=n;i++){
		string id = name[i];
		cout << id << " " << a[id].tot << " " << a[id].level << endl;
	}
}
void Calculation(string id){
	int grades = 0;
	grades += a[id].grade;
	grades += LongRun(a[id].time,a[id].gender);
	grades += SunnyRun(a[id].able);
	grades += FinalTest(id);
	grades += BodyExam(id);
	grades += Attendance(a[id].able,a[id].times);
	a[id].tot = grades;
	a[id].level = SetLevel(a[id].tot);
}
void Student(){
	for(int i=1;i<=n;i++){
		string id = name[i];
		Calculation(id); 
	}
}
void Run(){
	Getin();
	Student();
	Output();
}
signed main(){
	Run();
	return 0;
}
2024/5/12 22:46
加载中...