Submission #1156227


Source Code Expand

#include <bits/stdc++.h>

using namespace std;
#define int long long
#define all(a) (a).begin(), (a).end()
#define ms(a,v) memset(a, v, sizeof(a))
#define sz(v) ((int)(v).size())
#define mp make_pair
#define pb push_back
#define prev biiiiirl_sai_de_casa_comi_pra_caralho
#define next trapezio_descendente
#define index eh_ele_que_nos_vai_buscar
#define left aqui_eh_37_anos_porra
#define R32 ({int32_t x; scanf("%d", &x); x;})
#define RL ({long long x; scanf("%lld", &x); x;})
#define RC ({char x; scanf(" %c", &x); x;})
#define RI RL
#define ff first
#define ss second
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef long long ll;

int32_t main(){
  int n = RI;
  int C = RI;
  int K = RI;

  int t[n];
  for(int i = 0; i < n; i++){
    t[i] = RI;
  }

  sort(t, t+n);

  int ans = 0;
  int ptr = 0;
  while(ptr < n){
    int limit = t[ptr]+K;
    int sz = 0;

    while(ptr < n && sz < C && t[ptr] <= limit){
      ptr++, sz++;
    }

    ans++;
  }

  cout << ans << endl;
}

Submission Info

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

Compile Error

./Main.cpp: In function ‘int32_t main()’:
./Main.cpp:15:44: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 #define RL ({long long x; scanf("%lld", &x); x;})
                                            ^
./Main.cpp:17:12: note: in expansion of macro ‘RL’
 #define RI RL
            ^
./Main.cpp:27:11: note: in expansion of macro ‘RI’
   int n = RI;
           ^
./Main.cpp:15:44: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 #define RL ({long long x; scanf("%lld", &x); x;})
                                            ^
./Main.cpp:17:12: note: in expansion of macro ‘RL’
 #define RI RL
            ^
./Main.cpp:28:11: note: in expansion of macro ‘RI’
   int C = RI;
           ^
./Main.cpp:15:44: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
 #define RL ({long long x; scanf...

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 6 ms 768 KB
in2.txt AC 19 ms 1024 KB
in3.txt AC 19 ms 1024 KB
in4.txt AC 19 ms 1024 KB
in5.txt AC 1 ms 256 KB
in6.txt AC 19 ms 1024 KB
in7.txt AC 16 ms 896 KB
in8.txt AC 19 ms 1024 KB
sample1.txt AC 1 ms 256 KB
sample2.txt AC 1 ms 256 KB