Submission #139952

#TimeUsernameProblemLanguageResultExecution timeMemory
139952almogwaldMeetings (IOI18_meetings)C++14
17 / 100
100 ms19600 KiB
#include <utility> #include <algorithm> #include <math.h> #include <vector> #include <set> #include <iostream> //#include "job.h" #include "meetings.h" #define fori(i,n) for(int i=0;i<n;i++) #define forn(i,n) for(int i=1;i<n;i++) #define fort(i,m,n) for(int i=m;i<n;i++) #define forib(i,n) for(int i=n-1;i>=0;i--) #define fornb(i,n) for(int i=n-1;i>0;i--) #define maxl 1e18 #define con continue; typedef long long lol; using namespace std; typedef vector<int> veci; typedef vector<lol> vecl; typedef pair<lol,lol> point; lol sum=0; vecl minimum_costs(veci H, veci L,veci R) { int n=H.size(); vector<vecl> x(20,vecl(n)); x[0][0]= 2-H[0]; forn(i,n){ if(H[i]==1){ x[0][i]=x[0][i-1]+1; } } forn(i,20){ fori(j,n/2){ x[i][j]=max(x[i-1][2*j],x[i-1][2*j+1]); } } veci arr(n); arr[n-1]= n+1-H[n-1]; forib(i,n-1){ arr[i]=i; if(H[i]==1){ arr[i]=arr[i+1]; } } vecl C(L.size()); fori(i,C.size()){ int l=L[i]; int r=R[i]; if(arr[l]>r){ C[i]=r-l+1; con } C[i]=arr[l]-l; l=arr[l]; int k=0; while(l+(1<<k)<=r+1){ if(l&(1<<k)){ C[i]=max(C[i],x[k][l>>k]); l+=1<<k; } k++; } while(k>=0){ if(l+(1<<k)<=r+1){ C[i]=max(C[i],x[k][l>>k]); l+=1<<k; } k--; } C[i]=2*(R[i]-L[i]+1) - C[i]; } return C; }

Compilation message (stderr)

meetings.cpp: In function 'vecl minimum_costs(veci, veci, veci)':
meetings.cpp:9:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define fori(i,n) for(int i=0;i<n;i++)
meetings.cpp:46:7:
  fori(i,C.size()){
       ~~~~~~~~~~                
meetings.cpp:46:2: note: in expansion of macro 'fori'
  fori(i,C.size()){
  ^~~~
#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...