记录编号 597013 评测结果 AAWWWWWT
题目名称 儿童节快乐 最终得分 25
用户昵称 Gravatarzz 是否通过 未通过
代码语言 C++ 运行时间 2.560 s
提交时间 2024-11-16 18:12:14 内存使用 3.72 MiB
显示代码纯文本
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. freopen("happya.in","r",stdin);
  6. freopen("happya.out","w",stdout);
  7. int n,m,x[100001]={0},a,b,c,max[2]={0};
  8. char y[100001];
  9. cin>>n>>m;
  10. for(int i=0;i<m;i++)
  11. {
  12. cin>>y[i];
  13. if(y[i]=='I')
  14. {
  15. cin>>a>>b>>c;
  16. for(int j=a;j<=b;j++)
  17. x[j]+=c;
  18. }
  19. else
  20. {
  21. cin>>a>>b;
  22. for(int j=a;j<=b;j++)
  23. if(max[0]<x[j])
  24. {
  25. max[0]=x[j];
  26. max[1]=j;
  27. }
  28. cout<<max[0]<<endl;
  29. x[max[1]]=0;max[0]=0;max[1]=0;
  30. }
  31. }
  32. }