Submission #2198215


Source Code Expand

#include <iostream>

int main(){
    int n, cnt=0, ans=0;
    std::cin >> n;
    int a[n], b[n];
    for(int i=0; i<n; ++i){
        std::cin >> a[i];
    }
    for(int i=0; i<n; ++i){
        cnt=0;
        for(int j=0; j<n; ++j){
            if(a[i]>=a[j]-1) ++cnt;
            else if(a[i]<=a[j]+1) ++cnt;
        }
        if(cnt>ans){
            ans = cnt;
        }
    }
    std::cout << ans << std::endl;
    return 0;
}

Submission Info

Submission Time
Task C - Together
User wasebo555
Language C++14 (GCC 5.4.1)
Score 0
Code Size 452 Byte
Status WA
Exec Time 2107 ms
Memory 640 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 1
WA × 2
AC × 1
WA × 3
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 WA 1 ms 256 KB
0_001.txt WA 1 ms 256 KB
0_002.txt AC 1 ms 256 KB
1_003.txt WA 1 ms 256 KB
1_004.txt TLE 2103 ms 640 KB
1_005.txt TLE 2107 ms 640 KB
1_006.txt TLE 2103 ms 640 KB
1_007.txt TLE 2102 ms 640 KB
1_008.txt TLE 2103 ms 640 KB