QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#789480#9557. TemperanceyuanwuyuwuWA 2ms6076kbC++142.0kb2024-11-27 20:29:322024-11-27 20:29:33

Judging History

This is the latest submission verdict.

  • [2024-11-27 20:29:33]
  • Judged
  • Verdict: WA
  • Time: 2ms
  • Memory: 6076kb
  • [2024-11-27 20:29:32]
  • 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=0;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: 0
Wrong Answer
time: 2ms
memory: 6076kb

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

result:

wrong answer 3rd numbers differ - expected: '2', found: '0'