Submission #7685

# Submission time Handle Problem Language Result Execution time Memory
7685 2014-08-14T11:08:44 Z gs13068 CATS (NOI14_cats) C++
25 / 25
92 ms 1088 KB
#include<cstdio>
  
int main()
{
    int tcn;
    scanf("%d",&tcn);
    while(tcn--)
    {
        long long K,P;
        long long T,X,L,N;
        scanf("%lld%lld%lld",&X,&L,&N);
        X--;
        N<<=1;
        T=(L+N-1)/N;
        K=T-1;
        if(K>62)K=62;
        P=X%4;
        X=(X/4)&((1LL<<K)-1);
        for(K=0;X;X>>=1)K^=X&1;
        if((P==0||P==3)==K)printf("%lld\n",T*N+1);
        else printf("%lld\n",T*N);
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 0 ms 1088 KB Output is correct
3 Correct 0 ms 1088 KB Output is correct
4 Correct 0 ms 1088 KB Output is correct
5 Correct 0 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 0 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 0 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1088 KB Output is correct
2 Correct 0 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1088 KB Output is correct
2 Correct 4 ms 1088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 88 ms 1088 KB Output is correct
2 Correct 92 ms 1088 KB Output is correct