Submission #1499212


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

int main(){

    long long int n,c,k,ans,temp,j,p,s;
    scanf("%lld %lld %lld",&n,&c,&k);
    long long int T[n];
    for(int i=0;i<n;i++)
        scanf("%lld",&T[i]);
    sort(T,T+n);
    ans = 0;
    temp = 0;
    while(temp<n){
        j = 1;
        s = temp;
        p = T[temp];
        temp++;
        while(j<c && temp<n){
            if(p+k>=T[temp]){
                j++;
                temp++;
                p = T[temp];
            }
            else{
                break;
            }
        }
        ans++;
    }
    printf("%lld\n",ans);

    return 0;
}

Submission Info

Submission Time
Task A - Airport Bus
User uttam_02
Language C++14 (GCC 5.4.1)
Score 0
Code Size 660 Byte
Status WA
Exec Time 19 ms
Memory 1024 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:7:37: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%lld %lld %lld",&n,&c,&k);
                                     ^
./Main.cpp:10:28: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf("%lld",&T[i]);
                            ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 7
WA × 5
Set Name Test Cases
Sample sample1.txt, sample2.txt
All sample1.txt, sample2.txt, in1.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, sample1.txt, sample2.txt
Case Name Status Exec Time Memory
in1.txt AC 1 ms 256 KB
in2.txt AC 19 ms 1024 KB
in3.txt WA 19 ms 1024 KB
in4.txt AC 19 ms 1024 KB
in5.txt WA 1 ms 256 KB
in6.txt WA 19 ms 1024 KB
in7.txt WA 17 ms 896 KB
in8.txt WA 19 ms 1024 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB