QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#769827#9557. TemperanceXiaoMo247#TL 57ms12524kbC++201.2kb2024-11-21 19:32:162024-11-21 19:32:17

Judging History

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

  • [2024-11-21 19:32:17]
  • 评测
  • 测评结果:TL
  • 用时:57ms
  • 内存:12524kb
  • [2024-11-21 19:32:16]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

struct Node {
    int x, y, z;
    int id, val;
};

void solve() {
    int n; cin >> n;
    vector<Node> p(n + 1);
    int max_X = 0, max_Y = 0, max_Z = 0;
    for (int i = 1; i <= n; i++) {
        p[i].id = i; cin >> p[i].x >> p[i].y >> p[i].z;
        max_X = max(max_X, p[i].x); max_Y = max(max_Y, p[i].y); max_Z = max(max_Z, p[i].z);
    }
    vector<vector<int>> X(max_X + 1, vector<int>()), Y(max_Y + 1, vector<int>()), Z(max_Z + 1,vector<int>());
    
    for (int i = 1; i <= n; i++) {
        X[p[i].x].push_back(i); Y[p[i].y].push_back(i); Z[p[i].z].push_back(i);
    }

    vector<int> v;

    for (int i = 1; i <= n; i++) {
        p[i].val = max({X[p[i].x].size(), Y[p[i].y].size(), Z[p[i].z].size()});
        v.push_back(p[i].val);
    }

    sort(v.begin(), v.end());

    int res = 0;
    for (int k = 1; k <= n; k++) {
        while (res < v.size() && v[res] < k) res ++;
        cout << res << " ";
    }
    cout << '\n';
}

int main() {
    // freopen ("J.in", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int T; cin >> T;
    while (T--) solve();
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3624kb

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: 12524kb

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: 47ms
memory: 3584kb

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: 57ms
memory: 3696kb

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: -100
Time Limit Exceeded

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: