Submission #1557461
Source Code Expand
#include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #define F first #define S second #define int long long #define ull unsigned long long #define pb push_back using namespace std; using namespace __gnu_pbds; typedef tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; const int N = 110000; int cnt[N]; main() { ios_base::sync_with_stdio(false); cin.tie(NULL); //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); int n; cin >> n; for (int i = 1; i <= n; i++){ int x; cin >> x; cnt[x]++; } int ans = max(cnt[0], cnt[0] + cnt[1]); for (int i = 1; i <= 100001; i++){ ans = max(ans, cnt[i] + cnt[i - 1] + cnt[i + 1]); } cout << ans; }
Submission Info
Submission Time | |
---|---|
Task | C - Together |
User | Wrinx |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 828 Byte |
Status | AC |
Exec Time | 10 ms |
Memory | 1024 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 | 7 ms | 256 KB |
1_005.txt | AC | 9 ms | 256 KB |
1_006.txt | AC | 9 ms | 256 KB |
1_007.txt | AC | 9 ms | 256 KB |
1_008.txt | AC | 10 ms | 1024 KB |