QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#871270#9557. Temperance1903331632WA 1ms3712kbC++231.3kb2025-01-25 20:07:002025-01-25 20:07:00

Judging History

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

  • [2025-01-25 20:07:00]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3712kb
  • [2025-01-25 20:07:00]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e6 + 10;
#define pii pair<int, int>
#define lowbit(x) (x & (-x))
// int x[N], y[N], z[N];
int n;

void solve()
{
    cin >> n;
    map<int, int> x, y, z;
    for (int i = 0; i < n; i++)
    {
        int t1, t2, t3;
        cin >> t1 >> t2 >> t3;
        x[t1]++;
        y[t2]++;
        z[t3]++;
    }
    priority_queue<int, vector<int>, greater<int>> q1, q2, q3;
    int s1 = n;
    int s2 = n;
    int s3 = n;
    for (auto t : x)
        q1.push(t.second);

    for (auto t : y)
        q2.push(t.second);
    for (auto t : z)
        q3.push(t.second);
    for (int i = 0; i < n; i++)
    {
        while (q1.size() && q1.top() < i + 1)
        {
            s1 -= q1.top();
            q1.pop();
        }
        while (q2.size() && q2.top() < i + 1)
        {
            s2 -= q2.top();
            q2.pop();
        }
        while (q3.size() && q3.top() < i + 1)
        {
            s3 -= q3.top();
            q3.pop();
        }
        cout << n - max(s1, max(s2, s3)) << ' ';
    }
    cout << endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t = 1;
    cin >> t;
    while (t--)
        solve();
}

详细

Test #1:

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

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
Wrong Answer
time: 0ms
memory: 3712kb

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 1 1 5 
0 0 0 2 6 6 
0 0 0 3 7 7 7 
0 0 0 0 8 8 8 8 
0 
0 0 
0 0 0 
0 0 0 0 
0 0 1 1 5 
0 0 0 2 6 6 
0 0 0 3 7 7 7 
0 0 0 0 8 8 8 8 

result:

wrong answer 13th numbers differ - expected: '0', found: '1'