0%

[題解]主機排程

a132. 主機排程

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define N 10005
#define FOR(i,n) for(int i=0;i<n;i++)
#define pii pair<int,int>
#define max_ele(a) max_element(a,a+dh)
using namespace std;
int n,dh;

void solve(){
int s;cin>>s;
int arr[N]={0},brr[N]={0},crr[N]={0};
while(s--){
int a,b,c,d,e,f;cin>>a>>b>>c>>d>>e>>f;
int start = (a-1)*24+b;
for(int j=0;j<c;j++){
arr[(start+j)%dh]+=d;
brr[(start+j)%dh]+=e;
crr[(start+j)%dh]+=f;
}
}
cout<<*max_ele(arr)<<" "<<*max_ele(brr)<<" "<<*max_ele(crr)<<endl;
cin>>s;
}

int main(){
cin>>n>>dh;
dh = dh*24;
while(n--){
solve();
}
}