Submission #34681

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
346812017-11-15 01:26:17mohammad_kilaniWiring (IOI17_wiring)C++14
100 / 100
653 ms21588 KiB
#include "wiring.h"
#include <bits/stdc++.h>
using namespace std;
#define red 1
#define blue 0
const int N = 200010;
long long seg[4 * N] , lazy[4 * N] , dp[N];
vector< pair<int,bool> > v;
int n , nxt[N];
long long getmin(int s,int e,int idx,int l,int r){
if(s > r || e < l) return 1e18;
if(s >= l && e <= r) return seg[idx] + lazy[idx];
lazy[idx*2] += lazy[idx];
lazy[idx*2+1] += lazy[idx];
seg[idx] += lazy[idx];
lazy[idx] = 0;
return min(getmin(s,(s+e)/2,idx*2,l,r),getmin((s+e)/2+1,e,idx*2+1,l,r));
}
long long update(int s,int e,int idx,int l,int r,long long val){
if(s > r || e < l) return seg[idx] + lazy[idx];
if(s >= l && e <= r){
lazy[idx] += val;
return seg[idx] + lazy[idx];
}
lazy[idx*2] += lazy[idx];
lazy[idx*2+1] += lazy[idx];
lazy[idx] =0 ;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:37:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<r.size();i++){
               ^
wiring.cpp:38:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   while(j < b.size() && b[j] < r[i]) v.push_back(make_pair(b[j++],blue));
           ^
wiring.cpp:41:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  while(j < b.size()) v.push_back(make_pair(b[j++],blue));
          ^
#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...