Submission #1627345
Source Code Expand
#include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #define REP(i, m, n) for(int i=int(m);i<int(n);i++) #define EACH(i, c) for (auto &(i): c) #define all(c) begin(c),end(c) #define EXIST(s, e) ((s).find(e)!=(s).end()) #define SORT(c) sort(begin(c),end(c)) #define pb emplace_back #define MP make_pair #define SZ(a) int((a).size()) //#define LOCAL 1 #ifdef LOCAL #define DEBUG(s) cout << (s) << endl #define dump(x) cerr << #x << " = " << (x) << endl #define BR cout << endl; #else #define DEBUG(s) do{}while(0) #define dump(x) do{}while(0) #define BR #endif //改造 typedef long long int ll; using namespace std; //ここから編集する ll mod = 1000000007; int main() { int N; int cnt[100001] = {}; cin >> N; REP(i,0,N){ int tmp; cin >> tmp; cnt[tmp]++; } int ans = 0; REP(i,1,100000){ ans = max(ans,cnt[i-1] + cnt[i] + cnt[i+1]); } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Together |
User | homesentinel |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1576 Byte |
Status | AC |
Exec Time | 37 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 | 1 ms | 640 KB |
1_003.txt | AC | 1 ms | 640 KB |
1_004.txt | AC | 20 ms | 640 KB |
1_005.txt | AC | 37 ms | 640 KB |
1_006.txt | AC | 37 ms | 640 KB |
1_007.txt | AC | 37 ms | 640 KB |
1_008.txt | AC | 36 ms | 640 KB |