Submission #584457

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
5844572022-06-27 12:07:39benson1029Dancing Elephants (IOI11_elephants)C++14
100 / 100
6889 ms24496 KiB
#include "elephants.h"
#include<bits/stdc++.h>
using namespace std;
int n;
int RTN;
int cntGRP;
int l;
int a[150005];
int grp[150005];
vector<int> grpv[150005], dis[150005], nxt[150005];
vector< pair<int,int> > v;
int round_cnt = 0;
void calcgroup(int i) {
dis[i].resize(grpv[i].size());
nxt[i].resize(grpv[i].size());
int ptr = grpv[i].size()-1;
for(int j=grpv[i].size()-1; j>=0; j--) {
while(ptr > 0 && grpv[i][ptr] - grpv[i][j] > l) ptr--;
if(ptr == grpv[i].size()-1) {
dis[i][j] = 1;
nxt[i][j] = grpv[i][j] + l + 1;
} else {
dis[i][j] = dis[i][ptr+1] + 1;
nxt[i][j] = nxt[i][ptr+1];
}
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

elephants.cpp: In function 'void calcgroup(int)':
elephants.cpp:21:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |   if(ptr == grpv[i].size()-1) {
      |      ~~~~^~~~~~~~~~~~~~~~~~~
elephants.cpp: In function 'int update(int, int)':
elephants.cpp:69:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   69 |   for(int j=0; j<grpv[origgrp].size(); j++) {
      |                ~^~~~~~~~~~~~~~~~~~~~~
elephants.cpp:71:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   71 |     for(int k=j+1; k<grpv[origgrp].size(); k++) grpv[origgrp][k-1] = grpv[origgrp][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...