using macros affects runtime?

General topic about Valladolid Online Judge

Moderator: Board moderators

Post Reply
BlackBeard
New poster
Posts: 18
Joined: Wed Dec 17, 2014 9:44 pm

using macros affects runtime?

Post by BlackBeard » Thu Apr 30, 2015 11:48 pm

I've been using a lot of macros to code faster in uva online judge. I always try to solve problems with more efficient algorithms. but I always get more runtimes then my friends whose algorithms are not that much efficient. So it led me thinking if my using macro's causing extra runtime. Please help me with my confusion....
Here's the macros I always use...

Code: Select all

#define sc(x) scanf("%d",&x)
#define sc2(x,y) scanf("%d%d",&x,&y)
#define sc3(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define sc4(w,x,y,z) scanf("%d%d%d%d",&w,&x,&y,&z)
#define pr(x) printf("%d",x)
#define pr2(x,y) printf("%d %d",x,y)
#define pr3(x,y,z) printf("%d %d %d",x,y,z)
#define pr4(w,x,y,z) printf("%d %d %d %d",w,x,y,z)
#define prn(x) printf("%d\n",x)
#define prn2(x,y) printf("%d %d\n",x,y)
#define prn3(x,y,z) printf("%d %d %d\n",x,y,z)
#define prn4(w,x,y,z) printf("%d %d %d %d\n",w,x,y,z)
#define memc(x,y) memcpy(&x,&y,sizeof(x))
#define mems(x,y) memset(x,y,sizeof(x))
#define fli freopen("in.txt","r",stdin)
#define flo freopen("out.txt","w",stdout)
#define Rep(i,x,v) for(int i=x;i<v;i++)
#define Repe(i,x,v) Rep(i,x,v+1)
#define rep(i,v) Rep(i,0,v)
#define repe(i,v) rep(i,v+1)
#define Repr(i,x,v) for(int i=x;v<i;i--)
#define Repre(i,x,v) Repr(i,x,v-1)
#define repr(i,x) Repr(i,x,0)
#define repre(i,x) Repr(i,x,-1)
#define repv(i,x) for(auto i=x.begin();i!=x.end();i++)
#define reprv(i,x) for(auto i=x.rbegin();i!=x.rend();i++)
#define Repn(i,x,v) for(int i=x;i<v;i++,putchar('\n'))
#define repn(i,v) for(int i=0;i<v;i++,putchar('\n'))
#define bl putchar('\n')
#define PI acos(-1)
#define ign cin.ignore(100,'\n')
#define gcc getchar()
#define pcc putchar
#define si size
#define fi first
#define se second
#define pf push_front
#define pof pop_front
#define pb push_back
#define pob pop_back
#define mk make_pair
#define ll long long
#define ull unsigned long long
#define flerr 0.00000001
#define oo (ll)9e18
#define inf INT_MAX
#define MAX 1010

Mike Daniels
New poster
Posts: 1
Joined: Mon Jan 18, 2016 12:52 pm

Re: using macros affects runtime?

Post by Mike Daniels » Mon Jan 18, 2016 12:55 pm

This will be a great support for the latest comments and shares.

Post Reply

Return to “General”