Submission #957419

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9574192024-04-03 16:33:24AriadnaTopovi (COCI15_topovi)C++14
0 / 120
1328 ms40368 KiB
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MAX_ROOKS = 2e5;
int main() {
int n, k, p;
cin >> n >> k >> p;
map<int, int> xor_rows, xor_columns;
map<int, int> cnt_rows, cnt_columns;
cnt_rows[0] = cnt_columns[0] = n;
map<pair<int, int>, int> rooks;
ll total = 0;
while (k--) {
int r, c, x;
cin >> r >> c >> x;
rooks[{r, c}] = x;
total -= n-cnt_columns[xor_rows[r]];
total -= n-cnt_rows[xor_columns[c]];
if (xor_rows[r] ^ xor_columns[c]) ++total;
cnt_rows[xor_rows[r]]--;
xor_rows[r] ^= rooks[{r, c}];
cnt_rows[xor_rows[r]]++;
cnt_columns[xor_columns[c]]--;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...