比赛 2024暑假C班集训8 评测结果 AAAAAATTTT
题目名称 吉他 最终得分 60
用户昵称 Untitled 运行时间 4.065 s
代码语言 C++ 内存使用 6.87 MiB
提交时间 2024-07-08 09:47:23
显示代码纯文本
#include <bits/stdc++.h>
using namespace std;

int n,p,res,c[7][300010];

int main(){
    freopen("gitara.in","r",stdin);
    freopen("gitara.out","w",stdout);
    
    int x,y,m;
    scanf("%d %d",&n,&p);
    for (int i=1;i<=n;i++){
        scanf("%d %d",&x,&y);
        for (int j=y+1;j<=p;j++) res+=c[x][j],c[x][j]=0;
        if (c[x][y]==0){
            res++;
            c[x][y]++;
        }
    }
    printf("%d",res);
    
    return 0;
}