Submission #1793492
Source Code Expand
#include <iostream> #include <algorithm> #include <math.h> #include <vector> using namespace std; int main() { // your code goes here int n, cnt=1, ave, sum; cin >> n; vector<int> v(n); for(int i=0; i<n; i++) { cin >> v[i]; } sort(v.begin(), v.end()); int m=v[0]; for(int i=0; i<n-1; i++) { if(abs(m-v[i]) <= 2 || v[i] == m) cnt++; else { m = v[i]; cnt=1; } } cout << cnt << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Together |
User | kedama4156991 |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 459 Byte |
Status | WA |
Exec Time | 35 ms |
Memory | 640 KB |
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | WA | 1 ms | 256 KB |
0_001.txt | AC | 1 ms | 256 KB |
0_002.txt | AC | 1 ms | 256 KB |
1_003.txt | WA | 1 ms | 256 KB |
1_004.txt | AC | 18 ms | 640 KB |
1_005.txt | AC | 31 ms | 640 KB |
1_006.txt | AC | 33 ms | 640 KB |
1_007.txt | WA | 33 ms | 640 KB |
1_008.txt | WA | 35 ms | 640 KB |