QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#798961#9557. Temperancelaopohou#TL 1108ms13840kbC++141.3kb2024-12-04 19:44:532024-12-04 19:44:54

Judging History

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

  • [2024-12-04 19:44:54]
  • 评测
  • 测评结果:TL
  • 用时:1108ms
  • 内存:13840kb
  • [2024-12-04 19:44:53]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long 
const int N=2e5+10;
int n,m;
int x[N];
int y[N];
int z[N];
int dx[N];
int dy[N];
int dz[N];
int d[N];
priority_queue<int,vector<int> ,greater<int> > q;
priority_queue<int,vector<int> ,greater<int> > q2;
void solve(){
    for(int i=1;i<=100000;i++){
        dx[i]=0;
        dy[i]=0;
        dz[i]=0;
    }
    cin >> n;
    for(int i=1;i<=n;i++){
        int a,b,c;
        cin >> a >> b >> c;
        x[i]=a;
        y[i]=b;
        z[i]=c;
        dx[a]++;
        dy[b]++;
        dz[c]++;
    }
    
    while(q.size()!=0){
        q.pop();
    }
    while(q2.size()!=0){
        q2.pop();
    }
    for(int i=1;i<=n;i++){
        int num1=dx[x[i]]-1;
        int num2=dy[y[i]]-1;
        int num3=dz[z[i]]-1;
        d[i]=max(num1,max(num2,num3));
        //cout <<  d[i] << ' ';
    }
    for(int i=1;i<=n;i++){
        q.push(d[i]);
        q2.push(d[i]);
    }
    //cout << "--" << q.top() << ' ';
    for(int k=0;k<=n-1;k++){
        q=q2;
        int cnt=0;
        while(q.size()!=0&&q.top()<k){
            cnt++;
            q.pop();
        }
        cout << cnt << ' ';
    }
    cout << endl;
}
signed main(){
    int T;
    cin >> T;
    while(T--){
        solve();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
5
1 1 1
1 1 2
1 1 3
2 3 5
2 2 4
3
1 1 1
2 2 2
3 3 3

output:

0 0 2 5 5 
0 3 3 

result:

ok 8 numbers

Test #2:

score: 0
Accepted
time: 0ms
memory: 11852kb

input:

16
1
1 1 1
2
1 1 1
1 1 100000
3
1 1 1
1 1 100000
1 100000 1
4
1 1 1
1 1 100000
1 100000 1
1 100000 100000
5
1 1 1
1 1 100000
1 100000 1
1 100000 100000
100000 1 1
6
1 1 1
1 1 100000
1 100000 1
1 100000 100000
100000 1 1
100000 1 100000
7
1 1 1
1 1 100000
1 100000 1
1 100000 100000
100000 1 1
100000 ...

output:

0 
0 0 
0 0 0 
0 0 0 0 
0 0 0 1 5 
0 0 0 0 6 6 
0 0 0 0 7 7 7 
0 0 0 0 8 8 8 8 
0 
0 0 
0 0 0 
0 0 0 0 
0 0 0 1 5 
0 0 0 0 6 6 
0 0 0 0 7 7 7 
0 0 0 0 8 8 8 8 

result:

ok 72 numbers

Test #3:

score: 0
Accepted
time: 1020ms
memory: 11908kb

input:

10000
22
1 4 4
7 2 6
6 5 4
4 4 1
1 7 1
7 6 6
5 8 6
4 4 8
6 7 6
1 7 3
5 7 8
5 1 3
2 1 7
1 2 5
6 1 2
3 1 1
7 3 8
1 4 6
6 5 7
4 4 7
7 7 5
3 4 6
13
2 7 3
2 7 5
5 1 5
8 7 1
6 6 7
3 5 8
8 1 6
4 8 4
1 4 3
6 2 5
6 8 4
1 5 5
5 3 4
28
4 7 2
3 8 5
1 1 6
1 7 4
5 5 6
6 1 5
4 5 2
1 1 5
2 6 3
4 3 6
4 5 7
3 3 6
6 8...

output:

0 0 0 0 7 12 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 
0 0 3 9 13 13 13 13 13 13 13 13 13 
0 0 0 0 8 21 21 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 
0 0 1 9 9 14 14 14 14 14 14 14 14 14 
0 0 0 6 9 12 12 19 19 19 19 19 19 19 19 19 19 19 19 
0 0 0 0 3 8 10 22 36 36 36 36 3...

result:

ok 199157 numbers

Test #4:

score: 0
Accepted
time: 1033ms
memory: 13840kb

input:

10000
11
16 4 3
13 14 10
6 2 19
4 16 7
13 11 13
18 6 20
19 11 5
17 4 19
2 2 17
8 18 5
14 14 1
39
3 12 9
4 9 17
5 7 2
4 12 15
5 12 14
15 20 16
19 11 12
5 8 13
13 18 12
9 14 15
12 18 13
19 11 18
14 17 14
2 19 4
9 3 10
19 5 2
19 10 12
6 10 6
20 16 18
5 20 6
5 8 5
17 14 19
10 5 5
13 9 9
2 5 16
20 14 14
...

output:

0 2 11 11 11 11 11 11 11 11 11 
0 0 2 11 22 33 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 
0 
0 3 12 15 15 15 15 15 15 15 15 15 15 15 15 
0 1 3 21 25 32 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 3...

result:

ok 199593 numbers

Test #5:

score: 0
Accepted
time: 1108ms
memory: 11792kb

input:

10000
22
40126 51309 54005
77536 83774 68530
35537 89229 39298
26549 72686 40526
72054 78714 67371
54406 93387 54598
62891 79741 7031
21699 38166 16961
98001 73695 16118
23105 44313 87949
61147 44816 82830
40866 30839 37096
63254 98489 15491
2724 410 12208
96504 21764 35334
777 98615 64141
98638 282...

output:

0 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 
0 10 10 10 10 10 10 10 10 10 
0 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 29 
0 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 22 
0 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 26 2...

result:

ok 194828 numbers

Test #6:

score: -100
Time Limit Exceeded

input:

20000
13
2 7 2
11 1 15
7 11 11
14 3 2
8 4 2
14 13 3
1 3 9
1 9 6
10 5 9
3 6 14
11 3 2
10 10 2
4 14 8
18
7 1 7
15 6 14
10 4 2
9 11 6
12 3 2
6 12 4
14 14 8
15 6 4
9 12 1
14 4 6
3 5 13
15 1 5
5 7 3
14 7 14
6 13 5
15 15 5
3 13 5
5 4 13
17
12 12 9
10 12 9
6 11 4
15 1 14
6 3 15
6 6 10
6 8 3
15 5 9
12 6 7
1...

output:

0 3 7 8 8 13 13 13 13 13 13 13 13 
0 0 7 12 18 18 18 18 18 18 18 18 18 18 18 18 18 18 
0 0 5 6 17 17 17 17 17 17 17 17 17 17 17 17 17 
0 0 3 
0 1 5 5 5 
0 2 8 15 15 15 15 15 15 15 15 15 15 15 15 
0 1 6 9 9 9 9 9 9 
0 0 5 17 17 17 17 17 17 17 17 17 17 17 17 17 17 
0 1 5 5 5 
0 2 
0 
0 0 13 16 16 16 1...

result: