Submission #2172744
Source Code Expand
// ------------------------------------ // Date:2018/ 3/ 8 // Problem:ARC 082 Together c.cpp // // ------------------------------------ #include <bits/stdc++.h> using namespace std; #define EACH(i,a) for (auto&& i : a) #define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i) #define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) RFOR(i,0,n) #define ALL(a) (a).begin(),(a).end() #define debug(x) cerr << #x << ":" << x << endl typedef long long ll; static const int INF = 1000000001; int A[101010]; int main() { cin.tie(0); ios::sync_with_stdio(false); memset(A, 0, sizeof(A)); int N, tmp, mMax = -INF; cin >> N; REP(i, N) { cin >> tmp; ++A[tmp]; } int cnt; REP(i, 101001) { cnt = max(cnt, A[i] + A[i + 1] + A[i + 2]); } cout << cnt << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Together |
User | task4233 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 888 Byte |
Status | AC |
Exec Time | 9 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 | 640 KB |
0_001.txt | AC | 1 ms | 640 KB |
0_002.txt | AC | 2 ms | 640 KB |
1_003.txt | AC | 1 ms | 640 KB |
1_004.txt | AC | 7 ms | 640 KB |
1_005.txt | AC | 9 ms | 640 KB |
1_006.txt | AC | 9 ms | 640 KB |
1_007.txt | AC | 9 ms | 640 KB |
1_008.txt | AC | 9 ms | 640 KB |