QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#789469 | #9557. Temperance | yuanwuyuwu | WA | 1ms | 6096kb | C++14 | 2.0kb | 2024-11-27 20:27:56 | 2024-11-27 20:27:57 |
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=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;
}
Details
Tip: Click on the bar to expand more detailed information
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'