QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#712984#9303. Message Bombah_nafRE 0ms3616kbC++144.2kb2024-11-05 17:44:112024-11-05 17:44:12

Judging History

你现在查看的是最新测评结果

  • [2024-11-05 17:44:12]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:3616kb
  • [2024-11-05 17:44:11]
  • 提交

answer

/*________________________Bismillahir Rahmanir Rahim___________________
|                                                                      |
|                    /\     |     | |\    |     /\     |-------        |
|                   /  \    |     | | \   |    /  \    |               |
|                  /----\   |-----| |  \  |   /----\   |-----          |
|                 /      \  |     | |   \ |  /      \  |               |
|                /        \ |     | |    \| /        \ |               |
|                                                                      |
|                    14th batch CSE , ID : 12008029                    |
|                          Comilla University                          |
|                    Email: [email protected]                |
|                    Github: https://github.com/ah-naf                 |
|______________________________________________________________________*/
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>
#include <string>
#include <iostream>

using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define MAX 2000005
#define pb push_back
#define mp make_pair
#define vii vector<int>
#define vll vector<long long>
#define vp vector<pair<ll, ll>>
#define v_min(a) *min_element(a.begin(), a.end())
#define v_max(a) *max_element(a.begin(), a.end())
#define v_sum(a) accumulate(a.begin(), a.end(), 0LL)
#define un(a) a.erase(unique(a.begin(), a.end()), a.end())
#define SORT(a) sort(a.begin(), a.end())
#define AHNAF                     \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a) * (b)) / gcd(a, b)
#define endl '\n'
#define YES cout << "yes" << "\n"
#define NO cout << "no" << "\n"
#define testcase(t) \
    int t;          \
    cin >> t;       \
    while (t--)
#define reverse(a) reverse(a.begin(), a.end())
#define ff first
#define ss second
#define print(a)      \
    for (auto it: a) \
    cout << it << " "; \
    cout<<endl;
#define all(a) a.begin(), a.end()
#define sf(v)          \
    for (auto &it : v) \
    cin >> it

///--------------Graph Moves--------------------------------------
const int fx[] = {+1,-1,+0,+0};
const int fy[] = {+0,+0,+1,-1};
///const int fx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
///const int fy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
// const int fx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
// const int fy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
///---------------------------------------------------------------
bool checkbit(ll mask,int bit){return mask & (1LL<<bit);}
ll setbit(ll mask,int bit){ return mask | (1LL<<bit) ; }
ll clearbit(ll mask,int bit){return mask & ~(1LL<<bit);}
ll togglebit(ll mask,int bit){return mask ^ (1LL<<bit);}
//--------------------------------------------------------------//
 
template <typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
template <typename T, typename R> using ordered_map = tree<T, R, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// cout << *se.find_by_order(0) << endl; ///k th element
// cout << se.order_of_key(2) << endl; ///number of elements less than k

const int N = 1e5 + 5;

struct Node {
    int t, x, y;
};

void solve(int tc=1) {
    int n, m, q; cin>>n>>m>>q;
    vii ans(n+1, 0), group(m+1, 0);
    vector<Node> query(q+1);
    for(int i=0; i<q; i++) {
        cin>>query[i].t>>query[i].x>>query[i].y;
    }
    for(int i=q-1; i>=0; i--) {
        int t = query[i].t, x = query[i].x, y = query[i].y;
        if(t == 3) {
            group[y]++;
            ans[x]--;
        } else if(t == 2) {
            ans[x] -= group[y];
        } else {
            ans[x] += group[y];
        }
    }
    for(int i=1; i<=m; i++) {
        cout<<ans[i]<<endl;
    }

}

 
int main() {    
    AHNAF;
    // sieve();
    // phi_1_to_n();
    // prec();
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);  
    #endif
    int tc=1;
    // cin>>tc; 
    for(int i=1; i<=tc; i++) solve(i);
    
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3616kb

input:

3 3 10
1 3 2
1 3 1
1 1 2
1 2 1
3 1 2
2 3 1
3 3 2
3 2 1
3 3 2
3 2 1

output:

2
0
1

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 0ms
memory: 3496kb

input:

2 5 10
1 1 2
3 1 2
2 1 2
1 3 2
1 1 2
3 1 2
3 3 2
1 4 2
3 3 2
1 5 1

output:

2
0
1
1
0

result:

ok 5 lines

Test #3:

score: -100
Runtime Error

input:

10 100 1000
1 49 4
1 75 9
1 90 3
1 4 6
1 76 4
1 60 9
1 62 2
1 70 1
1 99 3
1 54 2
3 70 1
1 16 4
1 28 8
1 29 6
1 93 5
1 96 4
1 85 9
3 4 6
1 28 2
1 5 5
1 1 3
1 42 2
3 5 5
1 66 1
1 79 10
3 70 1
1 58 8
1 50 5
3 76 4
1 20 9
1 66 4
1 88 2
1 23 4
3 99 3
3 79 10
3 70 1
1 54 8
1 90 6
1 13 9
1 79 4
1 59 6
1 8 ...

output:


result: