Submission #1557441
Source Code Expand
#include <stdio.h> #include <algorithm> #include <iostream> #include <vector> #include <map> #include <set> #include <stdlib.h> #include <math.h> #include <string> #include <time.h> #include <string.h> #include <queue> #include <stack> #define pb push_back using namespace std; typedef long long int ll; ll mod=1e9+7; ll exp(ll t,ll x){if(x==0) return 1;if(x==1) return t;if(x%2==1) return (t*exp((t*t)%mod,x/2))%mod;if(x%2==0) return exp((t*t)%mod,x/2);} ll gcd(ll x,ll y){return x%y==0?y:gcd(y,x%y);} ll lcm(ll x,ll y){return x*(y/gcd(x,y));} ll bsum(ll u,ll b){return u<b?u:bsum(u/b,b)+u%b;} ll prival(ll u,ll p){int cn=0;while(u%p==0){cn++;u=u/p;}return cn;} bool isprime(ll x){for(ll i=2;i*i<=x;i++){if(x%i==0){return false;}}return true;} void YAY(void){cout<<"YES"<<endl;} void NAY(void){cout<<"NO"<<endl;} int n; int cc[111111]; int ind, rr=0; int main(void) { int i, j; cin>>n; for(i=1 ; i<=n ; i++) { int x; scanf("%d",&x); cc[x]++; cc[x+1]++; cc[x+2]++; } for(i=0 ; i<=111110 ; i++) { if(rr<cc[i]) { ind=i-1; rr=cc[i]; } } cout<<rr; return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Together |
User | rkm0959 |
Language | C++14 (GCC 5.4.1) |
Score | 300 |
Code Size | 1139 Byte |
Status | AC |
Exec Time | 11 ms |
Memory | 640 KB |
Compile Error
./Main.cpp: In function ‘int main()’: ./Main.cpp:36:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d",&x); ^
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 | 8 ms | 256 KB |
1_005.txt | AC | 10 ms | 256 KB |
1_006.txt | AC | 10 ms | 256 KB |
1_007.txt | AC | 10 ms | 256 KB |
1_008.txt | AC | 11 ms | 640 KB |