QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#201088 | #6540. Beautiful Sequence | ucup-team1209# | WA | 1ms | 3600kb | C++20 | 906b | 2023-10-05 10:35:48 | 2023-10-05 10:35:48 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for (int i=(x);i<=(y);i++)
#define drep(i,y,x) for (int i=(y);i>=(x);i--)
#define pii pair<int,int>
#define fir first
#define sec second
#define MP make_pair
template<typename T> bool chkmin(T &x,T y){return x>y?x=y,1:0;}
template<typename T> bool chkmax(T &x,T y){return x<y?x=y,1:0;}
void file() {
#ifdef zqj
freopen("a.in","r",stdin);
#endif
}
typedef long long ll;
#define sz 333333
int n;
int a[sz];
void work() {
cin>>n;
rep(i,1,n) cin>>a[i];
sort(a+1,a+n+1);
int cc=0;
drep(i,n,1) {
if (i==n||a[i]!=a[i+1]) ++cc;
if (cc>i-1+1) {
cout<<n-i<<'\n';
return;
}
}
cout<<n<<'\n';
}
int main() {
file();
ios::sync_with_stdio(false),cin.tie(0);
int T; cin>>T;
while (T--) work();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3428kb
input:
2 6 1 1 2 3 3 4 5 1 2 2 3 3
output:
4 4
result:
ok 2 number(s): "4 4"
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3600kb
input:
2 5 1 2 2 3 3 20 1 1 1 1 1 1 4 5 8 8 8 8 9 9 9 9 10 10 10 10
output:
4 15
result:
wrong answer 2nd numbers differ - expected: '17', found: '15'