We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int q = sc.nextInt();
int inc=0,inb=0;
int last = 0,x;
int a[][] = new int[q][3];
int b[] = new int[100000];
int c[] = new int[100000];
for(int i = 0; i<q ; i++)
{
for(int j=0;j<3;j++)
a[i][j] = sc.nextInt();
x = ((a[i][1]^last)%n); //sequence s1 or s0
if(a[i][0] == 1) // query 1 or 0
{
if(x == 0)
b[inb++] = a[i][2];
else
c[inc++] = a[i][2];
}
else{
if(x == 0)
last = b[a[i][2]%(inb)];
else
last = c[a[i][2]%(inc)];
System.out.println(last);
}
}
}
}
WOULD ANYONE MIND HELPING ME TO FIND WHATS WRONG WITH THIS PROGRAM?
Dynamic Array
You are viewing a single comment's thread. Return to all comments →
import java.io.; import java.util.;
public class Solution {
}
WOULD ANYONE MIND HELPING ME TO FIND WHATS WRONG WITH THIS PROGRAM?