Submission #2212485
Source Code Expand
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int,int> pi; #define mod 1000000007 #define rep(i,a,b) for (int i = a; i <= b; i++) #define f first #define s second #define pb push_back #define mp make_pair int n, a[202020], t, ans, l, r; int main(){ cin >> n; rep(i, 0, n-1)cin >> a[i]; sort(a, a+n); l=0;r=0; while(l<=r && r<n && l<n){ if(a[r]-a[l]<=2)r++; else l++; ans = max(r-l, ans); } cout << ans << endl; return 0;}
Submission Info
Submission Time | |
---|---|
Task | C - Together |
User | KazukiMH |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 526 Byte |
Status | AC |
Exec Time | 43 ms |
Memory | 640 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
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 | AC | 19 ms | 640 KB |
1_005.txt | AC | 38 ms | 640 KB |
1_006.txt | AC | 39 ms | 640 KB |
1_007.txt | AC | 40 ms | 640 KB |
1_008.txt | AC | 43 ms | 640 KB |