比赛 2024暑假C班集训8 评测结果 AAAAAATTTT
题目名称 吉他 最终得分 60
用户昵称 Untitled 运行时间 4.065 s
代码语言 C++ 内存使用 6.87 MiB
提交时间 2024-07-08 09:47:23
显示代码纯文本
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int n,p,res,c[7][300010];
  5.  
  6. int main(){
  7. freopen("gitara.in","r",stdin);
  8. freopen("gitara.out","w",stdout);
  9. int x,y,m;
  10. scanf("%d %d",&n,&p);
  11. for (int i=1;i<=n;i++){
  12. scanf("%d %d",&x,&y);
  13. for (int j=y+1;j<=p;j++) res+=c[x][j],c[x][j]=0;
  14. if (c[x][y]==0){
  15. res++;
  16. c[x][y]++;
  17. }
  18. }
  19. printf("%d",res);
  20. return 0;
  21. }