Submission #29166

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
291662017-07-18 13:25:16PrOAhMeTDancing Elephants (IOI11_elephants)C++14
100 / 100
8696 ms22812 KiB
#include <bits/stdc++.h>
#include "elephants.h"
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define LL long long
#define st first
#define nd second
#define endl '\n'
using namespace std;
const int N=150005,SQ=395;
int l,el[N],sq,dp[SQ][SQ*2+2],last[SQ][SQ*2+2],n,built;
vector<int> v[SQ];
void calc_bucket(int x) {
int cur=v[x].size()-1;
for(int i=v[x].size()-1;i>=0;--i) {
while(cur>i&&v[x][cur]-v[x][i]>l)
--cur;
if(cur+1==v[x].size()) {
dp[x][i]=1;
last[x][i]=v[x][i]+l;
}
else {
dp[x][i]=dp[x][cur+1]+1;
last[x][i]=last[x][cur+1];
}
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

elephants.cpp: In function 'void calc_bucket(int)':
elephants.cpp:21:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(cur+1==v[x].size()) {
             ^
elephants.cpp: In function 'void Delete(int, int)':
elephants.cpp:65:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(i=0;i<v[x].size()&&v[x][i]<y;++i)
            ^
elephants.cpp:69:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(;i<v[x].size();++i)
         ^
elephants.cpp: In function 'void Insert(int, int)':
elephants.cpp:83:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(i=0;i<v[x].size()&&v[x][i]<y;++i)
            ^
elephants.cpp:86:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(;i<v[x].size();++i)
         ^
elephants.cpp:89:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(v[x].size()>2*sq)
                 ^
elephants.cpp: In function 'int calculate()':
elephants.cpp:102:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if(cy==v[cx].size())
          ^
elephants.cpp: In function 'void print()':
elephants.cpp:115:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int j=0;j<v[i].size();++j)
                  ^
elephants.cpp: In function 'void printdp()':
elephants.cpp:124:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int j=0;j<v[i].size();++j)
                  ^
#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...