@[sam上帝](/space/show?uid=122822) 你样例都过不了
by Strong_Jelly @ 2019-05-23 15:25:39
@[sam上帝](/space/show?uid=122822) 把
```cpp
while(scanf("%lld%lld%lld%lld",&s[cnt].num,&s[cnt].time,&s[cnt].length,&s[cnt].first))
```
改成
```cpp
while(~scanf("%lld%lld%lld%lld",&s[cnt].num,&s[cnt].time,&s[cnt].length,&s[cnt].first))
```
就不会T了,但会WA + RE
by Strong_Jelly @ 2019-05-23 15:29:19
```cpp
#include <bits/stdc++.h>
using namespace std;
int t, now;
struct node
{
int num, s, t, sum, done;
friend bool operator < (node a, node b)
{
if(a.sum == b.sum)
{
return a.num > b.num;
}
else
{
return a.sum < b.sum;
}
}
}stu[1000001];
priority_queue < node, vector < node > > z;
int main()
{
int i = 1;
while(~scanf("%d %d %d %d", &stu[i].num, &stu[i].s, &stu[i].t, &stu[i].sum))
{
t = stu[i].s;
while(!z.empty())
{
node q = z.top();
if(max(now, q.s) + (q.t - stu[q.num].done) <= t)
{
printf("%d %d\n", q.num, max(now, q.s) + (q.t - stu[q.num].done));
now = max(now, q.s) + (q.t - stu[q.num].done);
z.pop();
}
else
{
stu[q.num].done += t - max(now, q.s);
now = t;
break;
}
}
z.push(stu[i]);
now = t;
++i;
}
while(!z.empty())
{
node q = z.top();
printf("%d %d\n", q.num, max(now, q.s) + (q.t - stu[q.num].done));
z.pop();
now = max(now, q.s) + (q.t - stu[q.num].done);
}
return 0;
}
```
by Strong_Jelly @ 2019-05-23 15:32:45
@[神兵qqq1112](/space/show?uid=143681) 所以为什么错了呢QwQ
by Merci @ 2019-05-23 21:54:38
@[神兵qqq1112](/space/show?uid=143681) 我样例过了呀
by Merci @ 2019-05-23 22:04:17
@[sam上帝](/space/show?uid=122822) 捕捉小可爱QwQ
by Frozencode @ 2019-08-03 20:14:41
@[Frozencode](/space/show?uid=64166) QwQ,抱抱
by Merci @ 2019-08-03 20:32:35
@[Merci](/space/show?uid=122822) 捕捉小可爱QwQ
by 微芒晨曦 @ 2019-10-29 07:13:39
@[Merci](/space/show?uid=122822)
# QAQ大神仙
by Blue_wonders @ 2019-10-29 07:15:26