样例都过不了......
查看原帖
样例都过不了......
776355
chrisxu1楼主2024/2/28 18:50

大佬们,帮帮蒟蒻看看这题代码怎么写吧!!!

#include<iostream>
#include<iomanip>
#include<string>
#include<cstring>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<queue>
#include<map>
#include<deque>
#include<stack>
#include<set>
#include<vector>
#define ll long long
#define ull unsigned long long
using namespace std;
ll ta, tb, tc, td;
ll A, H, E;
//题目要求 
struct node{
	ll problem_ask, student_find, score;
}people[10000005];
//评测题目,评测学号,评测分数 
ll problem[10000005];
//题目 
ll student[10000005];
//学号 
ll n, m, r;
//题目数量,学生数量,评测数量 
ll luogu, tradition;
//耗时 
ll all, cnt;
//备份和总数 
ll excel[10000005];
int main(){
	//freopen("fraction.in","r",stdin);
	//freopen("fraction.out","w",stdout);
	cin >> n >> m;
	for(int i = 1; i <= n; i ++){
		cin >> problem[i];
	}
	for(int i = 1; i <= m; i ++){
		cin >> student[i];
	}
	sort(problem + 1, problem + n + 1);
	sort(student + 1, student + m + 1);
	//输入后排序 
	cin >> ta >> tb >> tc >> td >> A >> H >> E;
	tradition = ta * n;
	//此处把传统耗时设为一个时间 * 次数 
	cin >> r;
	for(int i = 1; i <= r; i ++){
		cin >> people[i].problem_ask >> people[i].student_find >> people[i].score;
	}
	ll x = 0;
	for(int i = 1; i <= r; i ++){
		if(excel[people[i].problem_ask] < people[i].score){
			excel[people[i].problem_ask] = people[i].score;
			x += td;
		}
	}
	if(E){
		tradition += x;
	}
	for(int i = 1; i <= r; i ++){
		all ++;
		if(people[i - 1].problem_ask != people[i].problem_ask || people[i - 1].student_find != people[i].student_find || i == r){
			ll time1 = tb * all;
			ll time2 = ta + tc * all;
//			cout << time1 << " " << time2 << " " << all << endl;
			tradition += min(time1, time2);
			all = 0;
		}
		//传统总时间加一下 
	}
	luogu = (ta * n + tc * r) * 100 / A + H;
	//luogu耗时为上条代码 
	cout << tradition << endl << luogu << endl;
	if(luogu < tradition){
		cout << "Use Luogu!";
	} else {
		cout << "Forget it...";
	}
	//fclose(stdin);
	//fclose(stdout);
	return 0;
}
/*
2 3
4 2
2 5 4
54 47 14 13 94 124 0
10
4 4 90
4 2 50
2 4 90
4 4 90
2 5 40
4 5 60
4 2 30
2 2 80
4 2 20
2 2 20

509
387
Use Luogu!


5 5
6 8 10 7 3 
2 5 3 6 8 
72 46 18 16 85 480 1
50
3 8 100
10 3 90
8 6 100
10 6 100
6 8 50
10 5 70
8 6 80
3 2 10
3 8 50
3 6 0
3 6 90
7 5 100
3 8 20
8 3 70
8 5 70
7 8 70
7 6 60
10 8 80
6 3 50
3 3 100
3 3 10
8 6 40
7 5 70
6 6 0
10 5 90
7 2 100
7 6 20
7 6 20
7 2 40
10 8 50
10 5 30
10 3 90
3 6 90
8 2 60
10 2 10
6 8 40
3 6 10
8 2 0
3 6 60
10 2 20
10 6 0
10 3 20
7 8 50
8 2 70
10 6 100
3 3 0
8 5 100
3 5 40
10 2 10
7 8 0

2856
1962
Use Luogu!
*/
2024/2/28 18:50
加载中...