QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#767633#9557. TemperanceayWA 1ms3864kbC++17931b2024-11-20 21:32:002024-11-20 21:32:01

Judging History

This is the latest submission verdict.

  • [2024-11-20 21:32:01]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3864kb
  • [2024-11-20 21:32:00]
  • Submitted

answer

#include<bits/stdc++.h>

using namespace std;
#define int long long 
#define endl '\n'

void solve(){
    int n;
    cin >> n;
    vector<array<int, 3>> va(n);
    map<int, int> mmap1, mmap2, mmap3;
    for(int i = 0; i < n; i ++){
        cin >> va[i][0] >> va[i][1] >> va[i][2];
        mmap1[va[i][0]] ++, mmap2[va[i][1]] ++, mmap3[va[i][2]] ++;
    }
    vector<int> res(n);
    for(int i = 0; i < n; i ++){
        res[i] = max(mmap1[va[i][0]] - 1, max(mmap2[va[i][0]] - 1, mmap3[va[i][0]] - 1));
    }
    map<int, int> ans;
    for(int i = 0; i < n; i ++){
        ans[res[i]] ++;
    }
    int sum = 0;
    for(int i = 0; i < n; i ++){
        cout << sum << " ";
        sum += ans[i];
    }
    cout << endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    int t;
    cin >> t;
    while(t --){
        solve();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 1ms
memory: 3796kb

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'