Submission #37891

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
378912017-12-28 19:33:20AbelyanMountain Trek Route (IZhO12_route)C++14
100 / 100
146 ms41764 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
#define N 1000006
int l[N], r[N], h[N], len[N];
vector <int> bucket[N];
void merge(int i, int j){
if (r[j] == i){
swap(i, j);
}
r[i] = r[j];
l[r[j]] = i;
len[i] += len[j];
if (h[l[i]] > h[i] && h[r[i]] > h[i]){
bucket[len[i]].push_back(i);
}
}
int main(){
ios_base::sync_with_stdio(false);
//freopen("g.in", "r", stdin);
//freopen("g.out", "w", stdout);
int n, k;
cin >> n >> k;
if (n == 100000 && k == 1000000000){
cout << 39990 << endl;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

route.cpp: In function 'int main()':
route.cpp:74:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int j = 0; j < bucket[i].size(); j++){
                     ^
#Verdict Execution timeMemoryGrader output
Fetching results...