Contest Duration: ~ (local time) (100 minutes) Back to Home

Submission #6259972

Source Code Expand

Copy
```#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>

using namespace std;
#define REP(i,n) FOR(i,0,n)
#define FOR(i,a,b) for(long long i=(a),i##Len_=(b);i<i##Len_;i++)
typedef long long ll;
static const ll MOD = 1000000007;

int main()
{
ll N;

cin >> N;

vector <ll> a(N);

REP(i,N)
{
cin >> a[i];
}

ll cnt = 0;

ll tori = N;

sort(a.begin(),a.end());

ll mae = a[0];

if(a[0] > 100000)
{
cout << N << endl;
return 0;
}

cnt = 1;

bool flg = false;

for(ll i = 1; i < N; ++i)
{

if(mae == a[i])
{
cnt++;
}
else
{
if(cnt >= mae)
{
tori -= cnt - mae;
}
else
{
tori -= cnt;
}
cnt = 1;
mae = a[i];
}

if(a[i] > 100000)
{
tori -= N - i;
flg = true;

break;
}
}

//末尾処理
if(flg != true)
{
if(cnt >= mae)
{
tori -= cnt - mae;
}
else
{
tori -= cnt;
}
}

cout << N - tori << endl;

}

```

#### Submission Info

Submission Time 2019-07-07 12:42:02+0900 C - Good Sequence mozaic C++14 (GCC 5.4.1) 300 1361 Byte AC 45 ms 1024 KB

#### Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt
All 300 / 300 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt
Case Name Status Exec Time Memory
0_00.txt 1 ms 256 KB
0_01.txt 1 ms 256 KB
0_02.txt 1 ms 256 KB
0_03.txt 1 ms 256 KB
0_04.txt 1 ms 256 KB
1_00.txt 1 ms 256 KB
1_01.txt 1 ms 256 KB
1_02.txt 18 ms 1024 KB
1_03.txt 30 ms 1024 KB
1_04.txt 33 ms 1024 KB
1_05.txt 33 ms 1024 KB
1_06.txt 44 ms 1024 KB
1_07.txt 30 ms 1024 KB
1_08.txt 33 ms 1024 KB
1_09.txt 37 ms 1024 KB
1_10.txt 39 ms 1024 KB
1_11.txt 42 ms 1024 KB
1_12.txt 45 ms 1024 KB