QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#789469#9557. TemperanceyuanwuyuwuWA 1ms6096kbC++142.0kb2024-11-27 20:27:562024-11-27 20:27:57

Judging History

This is the latest submission verdict.

  • [2024-11-27 20:27:57]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 6096kb
  • [2024-11-27 20:27:56]
  • Submitted

answer

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <math.h>
#include <numeric>
using namespace std;
typedef long long ll;
const int maxn=2e5+10;
struct node{
    int x,y,z;
};
vector<node> plant(maxn);
vector<int> plant_value(maxn);
map<int,int> mp_x,mp_y,mp_z;
int main(){
    int T;
    scanf("%d",&T);
    while(T--){
        mp_x.clear();
        mp_y.clear();
        mp_z.clear();
        int n;
        scanf("%d",&n);
        for(int i=0;i<n;i++){
            int x,y,z;
            scanf("%d%d%d",&x,&y,&z);
            plant[i]={x,y,z};
            mp_x[x]++;
            mp_y[y]++;
            mp_z[z]++;
        }
        for(int i=0;i<n;i++){
            plant_value[i]=max(max(mp_x[plant[i].x],mp_y[plant[i].y]),mp_z[plant[i].z]);
        }
        // cout<<"mp_x"<<endl;
        // for(auto i:mp_x){
        //     cout<<i.first<<" "<<i.second<<endl;
        // }
        //  cout<<"mp_y"<<endl;
        // for(auto i:mp_y){
        //     cout<<i.first<<" "<<i.second<<endl;
        // }
        //  cout<<"mp_z"<<endl;
        // for(auto i:mp_z){
        //     cout<<i.first<<" "<<i.second<<endl;
        // }
        // cout<<"plant_value"<<endl;
        // for(int i=0;i<n;i++){
        //     cout<<plant_value[i]<<" ";
        // }
        // cout<<endl;
        sort(plant_value.begin(),plant_value.begin()+n);
        // cout<<"plant_value"<<endl;
        // for(int i=0;i<n;i++){
        //     cout<<plant_value[i]<<" ";
        // }
        // cout<<endl;
        int ans=0;
        int it_i=0;
        for(int k=1;k<=n;k++){
            // cout<<k<<endl;
            if(it_i==n){
                printf("%d",n);
                continue;
            }
            while((plant_value[it_i]<k)&&(it_i<n)){
                it_i++;
                ans++;
            }
            printf("%d ",ans);
        }
        printf("\n");
    }
    return 0;
}

詳細信息

Test #1:

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

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

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 77
0 0 0 0 8 888
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 77
0 0 0 0 8 888

result:

wrong answer 27th numbers differ - expected: '7', found: '77'