Skip to content

Commit

Permalink
fix niceday-2.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
t3nsor committed Jan 30, 2015
1 parent 261a51c commit 1e1c164
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# test case files
*.in
*.in.*
*.out
*.out.*

# autosave files
*~
7 changes: 4 additions & 3 deletions niceday-2.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// 2009-08-18
// corrected 2014-01-29
// The simple solution to NICEDAY. Doesn't generalize to LIS2 though;
// see niceday-1.cpp for another idea
#include <iostream>
Expand All @@ -14,7 +15,7 @@ int in() //INPUT HACK FOR EXTREME SPEED
x=(x<<1)+(x<<3)+c-'0';
}
}
static int BITPool[1000000]={0}; //DON'T RE-INITIALIZE MEMORY
static int BITPool[1000010]={0}; //DON'T RE-INITIALIZE MEMORY
int* BIT;
int N;
int query(int x)
Expand All @@ -26,7 +27,7 @@ int query(int x)
}
void insert(int x,int y)
{
for (;x<N;x|=x+1)
for (;x<=N;x|=x+1)
BIT[x]=max(BIT[x],y);
}
int main()
Expand All @@ -53,7 +54,7 @@ int main()
insert(first[i],second[i]);
}
printf("%d\n",res);
BIT+=100000;
BIT+=100001;
}
return 0;
}

0 comments on commit 1e1c164

Please sign in to comment.