제출 #115857

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
1158572019-06-09 10:55:39songc코끼리 (Dancing Elephants) (IOI11_elephants)C++14
100 / 100
3493 ms13384 KiB
#include "elephants.h"
#include <bits/stdc++.h>
using namespace std;
int N, K, M, Q;
int Sq=400;
int B[400][1000], sz[400];
int D[400][1000], C[400][1000];
int A[150505], T[150505];
void calc(int t){
if (!sz[t]) return;
int k=sz[t]-1;
for (int i=sz[t]-1; i>=0; i--){
while (B[t][i] + K < B[t][k]) k--;
if (k == sz[t]-1) D[t][i] = 1, C[t][i] = B[t][i] + K;
else D[t][i] = D[t][k+1] + 1, C[t][i] = C[t][k+1];
}
}
void init(int n, int l, int X[])
{
N=n, K=l;
M = (N+Sq-1)/Sq;
for (int i=0; i<N; i++){
B[i/Sq][sz[i/Sq]++] = X[i];
if (!Q) A[i] = X[i];
}
for (int i=0; i<M; i++) calc(i);
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

컴파일 시 표준 에러 (stderr) 메시지

elephants.cpp: In function 'void del(int)':
elephants.cpp:33:12: warning: 'k' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int t, k;
            ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...