제출 #198171

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
1981712020-01-25 02:19:32model_codeSwimming competition (LMIO18_plaukimo_varzybos)C++14
100 / 100
1008 ms12452 KiB
#include <iostream>
#include <algorithm>
#include <queue>
//#define INPUT_FILE
#ifdef INPUT_FILE
#include <fstream>
#endif
const long MAX_N = 1000000;
long n, a, b;
long swtime[MAX_N];
// Funkcija patikrina, ar galima sudėlioti dalyvius taip, kad
// maksimalus skirtumas tarp lėčiausio ir greičiausio būtų
// d_test ar mažesnis.
bool assign_groups(long d_test) {
std::queue<long> groups;
groups.push(-1);
long i = a - 1;
// Iš eilės einame nuo greičiausio iki lėčiausio ir bandome grupuoti.
// Tinkamas rastas grupes saugoje eilėje "groups".
// Algoritmo sudėtingumas - O(N)
while (i < n && !groups.empty()) {
if (i - groups.front() >= a) {
if (i - groups.front() <= b && (swtime[i] - swtime[groups.front() + 1]) <= d_test) {
// Grupė (nuo i iki groups.front()) yra leidžiamo ilgio bei
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...