QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#201088#6540. Beautiful Sequenceucup-team1209#WA 1ms3600kbC++20906b2023-10-05 10:35:482023-10-05 10:35:48

Judging History

你现在查看的是最新测评结果

  • [2023-10-05 10:35:48]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3600kb
  • [2023-10-05 10:35:48]
  • 提交

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;
}

詳細信息

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'