ROTATION : getting WA


#1

#include
#define MOD 1000000009

using namespace std;

int a[100009];

int main()
{
int n,m,i;
char x;
int y,r,t;
r=0;
cin>>n>>m;

for(i=0;i<n;i++)
{
    cin>>a*;
}

while(m--)
{
    cin>>x>>y;
    if(x=='C')
    {
        r=(r+y)%n;
    }
    else if(x=='A')
    {
        r=(r-y)%n;
    }
    else if(x=='R')
    {
        t=(r+y-1)%n;
        cout<<a[t]<<endl;
    }
}
return 0;

}


#2

have a look at this :-

ideone link


#3

thanks i misinterpreted mod operator