Submission #1591373


Source Code Expand

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <math.h>
#include <map>
#include <deque>
#include <queue>
#include <climits>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(v) sort(v.begin(), v.end())
#define SORTFUNC(v, func) sort(v.begin(), v.end(), func)
#define PRINT(v) REP(i, v.size()) printf("%d ", v[i]); cout << endl
#define IN(n) scanf("%d", &(n))

int main(){
  int n, c, k;
  IN(n); IN(c); IN(k);
  vector<int> tab(n);
  REP(i, n) IN(tab[i]);
  SORT(tab);

  int res = 0, people = 0, starttime = tab[0];
  REP(i, n){
    if (people == c){
      res++;
      people = 1;
      starttime = tab[i];
    }
    else {
      if(tab[i] > starttime+k){
        res++;
        people = 1;
        starttime = tab[i];
      }
      else people++;
    }
    //printf("people = %d, res = %d, startime = %d\n", people, res, starttime);
  }
  if(people > 0) res++;
  printf("%d\n", res);
  return 0;
}
























// I'd like to scroll past the end of document using Atom but I seemigly have to use these blank lines instead

Submission Info

Submission Time
Task A - Airport Bus
User iocto
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1357 Byte
Status AC
Exec Time 19 ms
Memory 640 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:29:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   IN(n); IN(c); IN(k);
        ^
./Main.cpp:29:15: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   IN(n); IN(c); IN(k);
               ^
./Main.cpp:29:22: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   IN(n); IN(c); IN(k);
                      ^
./Main.cpp:31:23: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   REP(i, n) IN(tab[i]);
                       ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 12
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 18 ms 640 KB
in3.txt AC 18 ms 640 KB
in4.txt AC 18 ms 640 KB
in5.txt AC 1 ms 256 KB
in6.txt AC 19 ms 640 KB
in7.txt AC 16 ms 640 KB
in8.txt AC 19 ms 640 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB