using sieve approach im getting tle.. can any one give me a good algo to do it..
#include<iostream>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;
#define MAX 2147483647
unsigned mark[(MAX>>5)+2];
#define checkp(x,n) (x[n>>5]&(1<<(n&31)))
#define setp(x,n) (x[n>>5]|=(1 ...
Search found 3 matches
- Wed Nov 24, 2010 1:20 am
- Forum: Volume 103 (10300-10399)
- Topic: 10325 - The Lottery
- Replies: 14
- Views: 9900
- Sun Nov 21, 2010 10:35 pm
- Forum: Volume 5 (500-599)
- Topic: 507 - Jill Rides Again
- Replies: 92
- Views: 45347
Re: 507 - Jill rides again
getting correct answer for alla the test case but gettin WA can any one help..
#include<iostream>
using namespace std;
#define LL long long int
LL arr[20005];
int main()
{
LL t,i,j,k,s,f,m,n;
LL maxsum,suffixmax;
freopen("1.txt","r",stdin);
cin>>t;
for(k=1;k<=t;k++)
{
scanf("%lld",&n ...
#include<iostream>
using namespace std;
#define LL long long int
LL arr[20005];
int main()
{
LL t,i,j,k,s,f,m,n;
LL maxsum,suffixmax;
freopen("1.txt","r",stdin);
cin>>t;
for(k=1;k<=t;k++)
{
scanf("%lld",&n ...
- Fri Nov 12, 2010 8:00 pm
- Forum: Volume 118 (11800-11899)
- Topic: 11858 - Frosh Week
- Replies: 20
- Views: 7912
Re: 11858 - Frosh Week
im getting runtime error can any one help me out ??/
#include<iostream>
#include<stdio.h>
using namespace std;
#define mx 1000001
long int r1[mx];
long int r2[mx];
int main()
{
long int p;
long int i;
long int cnt;
long int x;
while(scanf("%ld",&p)==1)
{
cnt=0;
for(i=1;i<=p;i ...
#include<iostream>
#include<stdio.h>
using namespace std;
#define mx 1000001
long int r1[mx];
long int r2[mx];
int main()
{
long int p;
long int i;
long int cnt;
long int x;
while(scanf("%ld",&p)==1)
{
cnt=0;
for(i=1;i<=p;i ...