Submission details
Task:Maalaus
Sender:zli0122
Submission time:2025-10-30 19:05:53 +0200
Language:C++ (C++11)
Status:READY
Result:10
Feedback
groupverdictscore
#1ACCEPTED10
#20
#30
#40
Test results
testverdicttimegroup
#1ACCEPTED0.00 s1, 3, 4details
#20.00 s3, 4details
#3ACCEPTED0.00 s1, 3, 4details
#40.12 s2, 4details
#50.09 s2, 4details
#60.01 s3, 4details
#70.01 s3, 4details
#80.15 s4details
#90.12 s4details
#10ACCEPTED0.00 s1, 3, 4details
#11ACCEPTED0.00 s1, 3, 4details
#12ACCEPTED0.08 s2, 4details
#13ACCEPTED0.07 s2, 4details
#140.12 s4details
#150.09 s4details
#160.12 s4details
#170.10 s4details

Code

#include<bits/stdc++.h>

using namespace std;

#define Debug(x) cout << #x << ": " << (x) << "\n"
#define debug(x) cout << #x << ": " << (x) << "; "

const int M = 200000;
int color_counts[M];

void solve() {
    int n, m, k, q;
    cin >> n >> m >> k >> q;
    stack<bool> cmd_is_row;
    stack<pair<int, int>> row_cmd, col_cmd;

    char ch;
    int loc, color;
    for (int i=0; i<q; i++) {
        cin >> ch >> loc >> color;
        cmd_is_row.push(ch == 'R');
        if (ch == 'R') row_cmd.push({loc-1, color-1});
        else col_cmd.push({loc-1, color-1});
    }

    unordered_set<int> row_d, col_d;
    bool is_row;
    int row_cmd_count=0, col_cmd_count=0;
    while (!cmd_is_row.empty()) {
        is_row = cmd_is_row.top();
        cmd_is_row.pop();

        if (is_row) {
            loc = row_cmd.top().first;
            color = row_cmd.top().second;
            row_cmd.pop();

            if (row_d.count(loc)) continue;

            row_d.insert(loc);
            row_cmd_count++;
            color_counts[color]+=(m-col_cmd_count);
        } else {
            loc = col_cmd.top().first;
            color = col_cmd.top().second;
            col_cmd.pop();

            if (col_d.count(loc)) continue;

            col_d.insert(loc);
            col_cmd_count++;
            color_counts[color]+=(n-row_cmd_count);
        }
    }
    for (int i=0;i<k;i++) cout << color_counts[i] << " ";
    cout << "\n";

}

int main() {
    cin.tie(0) -> ios::sync_with_stdio(0);
    solve();
}

Test details

Test 1 (public)

Group: 1, 3, 4

Verdict: ACCEPTED

input
3 4 4 4
R 1 1
C 3 4
R 2 2
R 1 1

correct output
4 4 0 1

user output
4 4 0 1 

Test 2 (public)

Group: 3, 4

Verdict:

input
1000000000 1000000000 5 10
C 70724881 4
C 290904744 1
C 569311326 5
R 896293092 1
...

correct output
3999999991 1999999998 19999999...

user output
-294967305 1999999998 19999999...

Feedback: Incorrect character on line 1 col 1: expected "3999999991", got "-294967305"

Test 3

Group: 1, 3, 4

Verdict: ACCEPTED

input
10 10 10 10
R 10 8
C 1 2
R 10 2
R 1 4
...

correct output
0 13 0 8 7 20 0 0 10 7

user output
0 13 0 8 7 20 0 0 10 7 

Test 4

Group: 2, 4

Verdict:

input
1000000000 1000000000 1 200000
R 185082082 1
C 549662476 1
R 484749097 1
R 330334821 1
...

correct output
199984000629575

user output
1733393223 

Feedback: Incorrect character on line 1 col 2: expected "199984000629575", got "1733393223"

Test 5

Group: 2, 4

Verdict:

input
1000000000 1000000000 1 200000
C 354072394 1
C 221236382 1
C 63527838 1
C 538599654 1
...

correct output
126261014543986

user output
1860943474 

Feedback: Incorrect character on line 1 col 2: expected "126261014543986", got "1860943474"

Test 6

Group: 3, 4

Verdict:

input
1000000000 1000000000 2000 200...

correct output
999999400 2999997760 999999118...

user output
999999400 -1294969536 99999911...

Feedback: Incorrect character on line 1 col 11: expected "2999997760", got "-1294969536"

Test 7

Group: 3, 4

Verdict:

input
1000000000 1000000000 2000 200...

correct output
999999481 0 999999445 0 0 0 0 ...

user output
999999481 0 999999445 0 0 0 0 ...

Feedback: Incorrect character on line 1 col 190: expected "3999998721", got "-294968575"

Test 8

Group: 4

Verdict:

input
1000000000 1000000000 200000 2...

correct output
0 0 999997829 0 1999872519 199...

user output
0 0 999997829 0 1999872519 199...

Feedback: Incorrect character on line 1 col 201: expected "2999746833", got "-1295220463"

Test 9

Group: 4

Verdict:

input
1000000000 1000000000 200000 2...

correct output
999986843 0 0 999966411 999971...

user output
999986843 0 0 999966411 999971...

Feedback: Incorrect character on line 1 col 549: expected "2999944914", got "-1295022382"

Test 10

Group: 1, 3, 4

Verdict: ACCEPTED

input
1 10 10 10
C 1 10
R 1 4
C 9 3
R 1 7
...

correct output
1 0 0 0 0 0 0 9 0 0

user output
1 0 0 0 0 0 0 9 0 0 

Test 11

Group: 1, 3, 4

Verdict: ACCEPTED

input
10 1 10 10
R 4 6
R 5 1
R 4 2
R 3 9
...

correct output
0 0 0 0 0 0 0 10 0 0

user output
0 0 0 0 0 0 0 10 0 0 

Test 12

Group: 2, 4

Verdict: ACCEPTED

input
1 1000000000 1 200000
C 298761159 1
R 1 1
C 831911362 1
C 25171734 1
...

correct output
1000000000

user output
1000000000 

Test 13

Group: 2, 4

Verdict: ACCEPTED

input
1000000000 1 1 200000
R 68306849 1
C 1 1
C 1 1
R 485427101 1
...

correct output
1000000000

user output
1000000000 

Test 14

Group: 4

Verdict:

input
1000000000 1000000000 100 2000...

correct output
2003899199298 2016897879262 20...

user output
-1850527934 -1736749858 966402...

Feedback: Incorrect character on line 1 col 1: expected "2003899199298", got "-1850527934"

Test 15

Group: 4

Verdict:

input
1000000000 1000000000 100 2000...

correct output
1267960483393 1326958437362 12...

user output
945131073 -186457102 -12354814...

Feedback: Incorrect character on line 1 col 1: expected "1267960483393", got "945131073"

Test 16

Group: 4

Verdict:

input
1000000000 1000000000 10000 20...

correct output
26998778013 13999380552 239989...

user output
1228974237 1114478664 -1770885...

Feedback: Incorrect character on line 1 col 1: expected "26998778013", got "1228974237"

Test 17

Group: 4

Verdict:

input
1000000000 1000000000 10000 20...

correct output
7999699356 8999760379 12999665...

user output
-590235236 409825787 114763972...

Feedback: Incorrect character on line 1 col 1: expected "7999699356", got "-590235236"