-
Notifications
You must be signed in to change notification settings - Fork 0
/
201709-2.cpp
82 lines (81 loc) · 1.05 KB
/
201709-2.cpp
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include<iostream>
using namespace std;
int main()
{
int n,k,end=0,start=10111,i,j,t,ti;
cin>>n>>k;
int cl[1010],w[1010],s[1010],c[1010],q[1010];
for(t=1;t<=n;t++)
{
cl[t]=t;
}
for(t=1;t<=k;t++)
{
cin>>w[t]>>s[t]>>c[t];
c[t]=s[t]+c[t];
if(c[t]>end)
end=c[t];
if(s[t]<start)
start=s[t];
}
for(ti=start;ti<=end;ti++)
{
//huan
int huan=0;
for(i=1;i<=k;i++)
{
if(c[i]==ti)
{
huan++;
q[huan]=w[i];
}
}
for(i=1;i<=huan;i++)
{
for(j=1;j<=huan;j++)
{
if(q[i]<q[j])
{
int ty=q[i];
q[i]=q[j];
q[j]=ty;
}
}
}
for(i=1;i<=huan;i++)
{
int po=1;
for(j=1;j<=n&&po;j++)
{
if(cl[j]==0)
{
cl[j]=q[i];
po=0;
}
}
}
//qu
for(i=1;i<=k;i++)
{
if(s[i]==ti)
{
int po=1;
for(j=1;j<=n&&po;j++)
{
if(cl[j]==w[i])
{
cl[j]=0;
po=0;
}
}
}
}
}
for(i=1;i<=n;i++)
{
cout<<cl[i];
if(i!=n)
cout<<" ";
}
return 0;
}