QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#749734#9544. Grand Prix of BallanceForever_Young#WA 2ms9384kbC++231.3kb2024-11-15 09:47:102024-11-15 09:47:10

Judging History

你现在查看的是最新测评结果

  • [2024-11-15 09:47:10]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:9384kb
  • [2024-11-15 09:47:10]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define data dataa
using LL=long long;
using ULL=unsigned long long;
using LD=long double;
const int N=int(1e5)+10;
int cnt[N],score[N],p[N],n,m,q;
bool active[N];
set<int>s[N];
int main()
{
    int T;
    for(scanf("%d",&T);T--;)
    {
        scanf("%d%d%d",&n,&m,&q);
        rep(i,m)s[i].clear(),score[i]=0;
        rep(i,n)active[i]=0,cnt[i]=0;
        rep(i,q)
        {
            int opt,id,x;scanf("%d",&opt);
            if(opt==1)
            {
                scanf("%d",&x);
                active[x]=1;
            }
            else if(opt==2)
            {
                scanf("%d%d",&id,&x);
                if(!active[x])continue;
                if(s[id].contains(x))continue;
                s[id].insert(x);
                score[id]+=m-cnt[x];
                cnt[x]++;
            }
            else if(opt==3)
            {
                scanf("%d%d",&id,&x);
                if(!active[x])continue;
                s[id].insert(x);
            }
        }
        rep(i,m)p[i]=i;
        sort(p+1,p+m+1,[&](int x,int y){return score[x]!=score[y]?score[x]>score[y]:x<y;});
        rep(i,m)printf("%d %d\n",p[i],score[p[i]]);
    }
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 9384kb

input:

3
3 4 6
1 2
2 1 1
2 2 2
3 3 2
2 3 2
2 1 2
3 4 8
1 2
2 1 1
2 2 2
3 3 2
2 3 2
2 1 2
1 1
2 1 1
3 4 7
1 2
2 1 1
2 2 2
3 3 2
2 3 2
2 1 2
1 1

output:

2 4
1 3
3 0
4 0
1 7
2 4
3 0
4 0
2 4
1 3
3 0
4 0

result:

ok 12 lines

Test #2:

score: -100
Wrong Answer
time: 2ms
memory: 8528kb

input:

10
18 8 8
2 1 6
1 13
2 1 18
3 8 13
2 7 14
2 5 11
3 6 13
3 1 13
26 7 11
1 22
2 7 22
1 9
2 6 24
1 2
1 18
3 3 4
2 3 18
1 26
3 7 1
3 2 26
1 3 33
3 3 1
2 3 1
2 2 1
1 1
2 1 1
2 1 1
3 1 1
3 3 1
3 2 1
3 3 1
2 2 1
2 2 1
3 3 1
2 2 1
2 2 1
3 3 1
2 3 1
2 3 1
3 3 1
2 3 1
2 2 1
2 2 1
2 2 1
2 1 1
3 2 1
2 2 1
3 2 1...

output:

1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
3 7
7 7
1 0
2 0
4 0
5 0
6 0
1 3
2 0
3 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0
16 0
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
22 25
25 25
1 0
2 0
3 0
4 0
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0
13 0
14 0
15 0
16 0
17 0
18 0
19 0
20 0
21 0
23 0
24 0
1 0
2 0...

result:

wrong answer 43rd lines differ - expected: '25 25', found: '22 25'