马蜂良好有注释求条
查看原帖
马蜂良好有注释求条
852637
songtaoran楼主2025/1/22 16:57

rt,看了讨论区的 hack & 警示后人,hack 没过,但是对着警示后人调完了也没过。

#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll inf = 9e18;
struct student{
	ll id, score; // 编号,分数
	ll sex; // 性别,0为男生,1为女生
	ll cnt1, cnt2; // 阳光长跑合法次数,班级训练营次数
	ll lsttm = -inf; // 上一条阳光长跑的结束时间 
}stu[10010];
map<ll, ll> pos;
ll n, m, a, b, c, p, s, f, t;
ll M, D, h1, m1, s1, h2, m2, s2, st, ed;
ll days[20] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
// 每个月的天数(2017不是闰年) 
double l;
char ch;
ll get1(ll tm){
	if(tm <= 750)      return 20;
	else if(tm <= 780) return 18;
	else if(tm <= 810) return 16;
	else if(tm <= 840) return 14;
	else if(tm <= 870) return 12;
	else if(tm <= 910) return 10;
	else if(tm <= 950) return 8;
	else if(tm <= 990) return 6;
	else if(tm <= 1030)return 4;
	else if(tm <= 1080)return 2;
	else               return 0;
}
ll get2(ll tm){
	if(tm <= 400)      return 20;
	else if(tm <= 417) return 18;
	else if(tm <= 434) return 16;
	else if(tm <= 451) return 14;
	else if(tm <= 470) return 12;
	else if(tm <= 485) return 10;
	else if(tm <= 500) return 8;
	else if(tm <= 515) return 6;
	else if(tm <= 530) return 4;
	else if(tm <= 540) return 2;
	else               return 0;
}
ll get3(ll cnt){
	if(cnt >= 21)      return 10;
	else if(cnt >= 19) return 9;
	else if(cnt >= 17) return 8;
	else if(cnt >= 14) return 7;
	else if(cnt >= 11) return 6;
	else if(cnt >= 7)  return 4;
	else if(cnt >= 3)  return 2;
	else               return 0;
}
ll get4(ll cnt){
	if(cnt >= 18)      return 5;
	else if(cnt >= 15) return 4;
	else if(cnt >= 12) return 3;
	else if(cnt >= 9)  return 2;
	else if(cnt >= 6)  return 1;
	else               return 0;
}
void get5(ll sc){
	if(sc >= 95)      puts("A");
	else if(sc >= 90) puts("A-");
	else if(sc >= 85) puts("B+");
	else if(sc >= 80) puts("B");
	else if(sc >= 77) puts("B-");
	else if(sc >= 73) puts("C+");
	else if(sc >= 70) puts("C");
	else if(sc >= 67) puts("C-");
	else if(sc >= 63) puts("D+");
	else if(sc >= 60) puts("D");
	else              puts("F");
}
ll change(ll month, ll day, ll hour, ll minute, ll second){
	ll ans = (day - 1) * 86400;
	for(ll i = 1; i < month; i++) ans += days[i] * 86400;
	return ans + hour * 3600 + minute * 60 + second;
}
bool check(){
	double tmp1 = l * 1000.0 / (ed - st), tmp2 = l * 1000.0 / s;
	if(l < (stu[p].sex ? 1.5 : 3.0) || tmp1 < 2 || tmp1 > 5 || tmp2 > 1.5 || 
	   st - stu[p].lsttm < 21600) return false;
	return true;
}
int main(){
	cin >> n;
	for(ll i = 1; i <= n; i++){
		scanf("%lld", &p); pos[p] = i; stu[i].id = p;
		cin >> ch >> s;
		if(ch == 'M') stu[i].sex = 0;
		else stu[i].sex = 1;
		stu[i].score = s;
		scanf("%lld\'%lld\"", &a, &b);
		if(ch == 'M') stu[i].score += get1(a * 60 + b);
		else stu[i].score += get2(a * 60 + b);
		cin >> ch;
		if(ch == 'P') stu[i].score += 10;
		scanf("%lld %lld", &f, &c);
		stu[i].score += f; stu[i].cnt2 = c;
	}
	cin >> m;
	for(ll i = 1; i <= m; i++){
		scanf("%lld %lld", &t, &p); p = pos[p];
		M = t / 100 % 100; D = t % 100;
		scanf("%lld:%lld:%lld", &h1, &m1, &s1);
		scanf("%lld:%lld:%lld", &h2, &m2, &s2);
		st = change(M, D, h1, m1, s1), ed = change(M, D, h2, m2, s2);
		scanf("%lf %lld'%lld\" %lld", &l, &a, &b, &s);
		if(check()) stu[p].cnt1++;
		stu[p].lsttm = ed;
	}
	for(ll i = 1; i <= n; i++)
		stu[i].score += get3(stu[i].cnt1) + get4(stu[i].cnt1 + stu[i].cnt2);
	for(ll i = 1; i <= n; i++)
		printf("%lld %lld ", stu[i].id, stu[i].score), get5(stu[i].score);
	return 0;
}
2025/1/22 16:57
加载中...