QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#774914#9557. Temperancehela_yht#TL 1845ms8532kbC++201.4kb2024-11-23 14:11:232024-11-23 14:11:31

Judging History

This is the latest submission verdict.

  • [2024-11-23 14:11:31]
  • Judged
  • Verdict: TL
  • Time: 1845ms
  • Memory: 8532kb
  • [2024-11-23 14:11:23]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define int ll
typedef pair<int, int> PII;
const int N = 2e5 + 5, INF = 0x3f3f3f3f;

struct Node
{
    int x, y, z;
    int numx = 0, numy = 0, numz = 0;
};

void solve()
{

    int n;
    cin >> n;
    vector<int> X(N), Y(N), Z(N);
    vector<Node> a(n + 1);
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i].x >> a[i].y >> a[i].z;
        X[a[i].x]++;
        Y[a[i].y]++;
        Z[a[i].z]++;
    }
    for (int i = 1; i <= n; i++)
    {
        a[i].numx = X[a[i].x] - 1;
        a[i].numy = Y[a[i].y] - 1;
        a[i].numz = Z[a[i].z] - 1;
    }
    // for (int i = 1;i <= n;i++)
    // {
    //     cout << a[i].numx << "  " << a[i].numy << "  " << a[i].numz << endl;
    // }
    vector<int> D;
    for (int i = 1; i <= n; i++)
    {
        D.push_back(max(max(a[i].numx, a[i].numy), a[i].numz));
    }
    // for (auto y: D)
    // {
    //     cout << y << " ";
    // }
    // cout << endl;
    vector<int> E(n + 10);
    for (int i = 0; i < n; i++)
    {
        E[D[i] + 1]++;
    }
    for (int i = 1; i <= n; i++)
        E[i] += E[i - 1];
    for (int i = 0; i < n; i++)
    {
        cout << E[i] << " ";
    }
    cout << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int _ = 1;
    cin >> _;
    while (_--)
        solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 8176kb

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: 6ms
memory: 8236kb

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: 1845ms
memory: 8240kb

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: 1803ms
memory: 8532kb

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: 1826ms
memory: 8236kb

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: