Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- inline int GCD (int a, int b) { return b == 0 ? a : GCD(b, a % b); }
- inline int LCM (int a, int b) { return a * b / GCD(a, b); }
- #define endl '\n';
- #define WHILE(n) while(n--)
- #define pb push_back
- #define PI acos(-1)
- typedef pair<int, int> pii;
- typedef long long ll;
- typedef long double ld;
- typedef long long int lli;
- typedef unsigned long long ull;
- bool isable[100001];
- int mules[100001];
- int main(){
- cin.sync_with_stdio(0);
- cin.tie(0);
- int t, n, c;
- cin >> t;
- WHILE(t){
- fill_n(mules, 10001, 0);
- fill_n(isable, 1001, false);
- cin >> n >> c;
- WHILE(c){
- string d; int a, b;
- cin >> d;
- if(d == "A"){
- cin >> a >> b;
- if(isable[b] != true){
- mules[b] += a;
- }
- }
- else if(d == "Q"){cin >> a; cout << mules[a] << endl;}
- else if(d == "G"){
- cin >> a;
- int tot = 0;
- for(int i = 1; i <= a; i++){
- tot += mules[i];
- }
- cout << tot << endl;
- }
- else if(d == "L"){
- cin >> a;
- int tot = 0;
- for(int i = n+1; i > n-a; i--){
- tot += mules[i];
- }
- cout << tot << endl;
- }
- else if(d == "Covfefe"){
- cin >> a;
- isable[a] = true;
- mules[a] = 0;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement