Submission #2212535


Source Code Expand

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int T[100005] ;

int com ( const void* a, const void*b ) {
    return *(int*)a - *(int*)b ;
}

int main () {
    int N, C, K, result, i, c;
    scanf ( "%d %d %d", &N, &C, &K ) ;
    for ( i = 0 ; i < N ; i++ ) {
        scanf ( "%d", &T[i] ) ;
    }
    qsort ( T, N, sizeof (int), com ) ;
    for ( i = 0 , result = 1, c = 1 ; i < N ; i++ ) {
        if ( T[i] - T[i+1] <= C && c < C ) {
            c++ ;
        }
        else {
            c = 1 ;
            result++ ;
        }
    }
    printf ( "%d", result ) ;
}

Submission Info

Submission Time
Task A - Airport Bus
User vjudge5
Language C++14 (GCC 5.4.1)
Score 0
Code Size 602 Byte
Status WA
Exec Time 24 ms
Memory 892 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:14:38: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf ( "%d %d %d", &N, &C, &K ) ;
                                      ^
./Main.cpp:16:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
         scanf ( "%d", &T[i] ) ;
                               ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 2
AC × 4
WA × 8
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 WA 1 ms 128 KB
in2.txt WA 24 ms 892 KB
in3.txt WA 24 ms 892 KB
in4.txt WA 24 ms 892 KB
in5.txt WA 1 ms 128 KB
in6.txt WA 24 ms 892 KB
in7.txt WA 22 ms 892 KB
in8.txt WA 24 ms 892 KB
sample1.txt AC 0 ms 128 KB
sample2.txt AC 1 ms 128 KB