# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
961816 | ASN49K | Topovi (COCI15_topovi) | C++14 | 778 ms | 33668 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) x.begin(),x.end()
#define LINE 0
#define COLOUMN 1
using i64=long long;
map<int,int>value[2],cnt[2];
map<pair<int,int>,int>mpp;
int n;
i64 cost;
void calculate(int poz,int tip,int sign)
{
cnt[tip][value[tip][poz]]+=sign;
cost+=sign*(n-cnt[tip^1][value[tip][poz]]);
}
void add(int poz,int val,bool tip)
{
calculate(poz,tip,-1);
value[tip][poz]^=val;
calculate(poz,tip,1);
}
void change(int l1,int r1,int l2,int r2)
{
int vall=mpp[make_pair(l1,r1)];
add(l1,vall,LINE);
add(r1,vall,COLOUMN);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |