Submission #2251110


Source Code Expand

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define boost ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define pii pair<ll,ll>
int main()
{
    boost;
    int n,x,ans=0;
    cin>>n;
    int arr[n];
    for(int i=0;i<n;i++)
    cin>>arr[i];
    for(int i=0;i<n;i++)
    {
        int cnt=0;
        int x=arr[i];
        for(int j=0;j<n;j++)
        {
            if(abs(arr[j]-x)==1)
            {
                cnt++;
            }
        }
        ans=max(ans,cnt+1);
    }
    cout<<ans<<endl;
}

Submission Info

Submission Time
Task C - Together
User at_17
Language C++14 (GCC 5.4.1)
Score 0
Code Size 587 Byte
Status TLE
Exec Time 2103 ms
Memory 640 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 4
TLE × 5
Set Name Test Cases
Sample 0_000.txt, 0_001.txt, 0_002.txt
All 0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt
Case Name Status Exec Time Memory
0_000.txt AC 1 ms 256 KB
0_001.txt AC 1 ms 256 KB
0_002.txt AC 1 ms 256 KB
1_003.txt AC 1 ms 256 KB
1_004.txt TLE 2103 ms 640 KB
1_005.txt TLE 2103 ms 640 KB
1_006.txt TLE 2103 ms 640 KB
1_007.txt TLE 2103 ms 640 KB
1_008.txt TLE 2103 ms 640 KB