F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Xor

Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 130712/130712 K (Java/Others)
Total Submission(s): 313    Accepted Submission(s): 154


Problem Description
Given n non-negative integers, We define a statistical function as follows:

It will be noted that the nature of F(k) is calculated with the number of choices, such that:
1)0¡Übi¡Üai£¬0¡Üi¡Ün-1£¬bi is a integer.
2)b0 xor b1 xor ... xor bn-1 = k£¬xor means exclusive-or operation.  
Now given A and m operations, there are two different operations:
1)C x y: set the value of ax to y£»
2)Q x: calculate F(x) mod P, where P = 1000000007.
 

Input
The first line has a number T (T ¡Ü 10), indicating the number of test cases.
For each test case, the first line contains tow integers n, m, (1¡Ün, m¡Ü20000), denote the n, m that appear in the above description. Then next line contains n non-negative integers denote
(0¡Üai¡Ü1000).
Then next m lines. Each line is one of the follow two:
1)C x y: set the value of ax to y£»(0¡Üx¡Ün-1£¬0¡Üy¡Ü1000)
2)Q x: calculate F(x) mod P, where P = 1000000007.
The number of the first operation is not more than 5000.
 

Output
For each Q operation, output the value of F(x) mod P.
 

Sample Input
1 2 5 3 2 Q 3 C 0 2 Q 3 Q 0 C 0 3
 

Sample Output
3 2 3
 

Author
FZU
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 11:19:27, Gzip enabled