QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#774870#9557. Temperancehela_yht#RE 0ms3524kbC++201.4kb2024-11-23 14:06:092024-11-23 14:06:09

Judging History

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

  • [2024-11-23 14:06:09]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:3524kb
  • [2024-11-23 14:06:09]
  • 提交

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 + 1), Y(n + 1), Z(n + 1);
    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].y] - 1;
    }
    // cout << "====" << endl;
    vector<int> D;
    for (int i = 1; i <= n; i++)
    {
        // cout << "----" << max(max(a[i].numx, a[i].numy), a[i].numz) << endl;
        D.push_back(max(max(a[i].numx, a[i].numy), a[i].numz));
    }
    // 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 << "----" << endl;
        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: 3524kb

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: -100
Runtime Error

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 

result: