QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#789480 | #9557. Temperance | yuanwuyuwu | WA | 2ms | 6076kb | C++14 | 2.0kb | 2024-11-27 20:29:32 | 2024-11-27 20:29:33 |
Judging History
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'