# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
255557 | Vladikus004 | Zamjene (COCI16_zamjene) | C++14 | 6094 ms | 172148 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>
#define inf 2e9
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
mt19937_64 rnd(time(0));
const int N = 1000000 + 3;
int n, q, sz[N], a[N], b[N], p[N], cnt, ans3;
ll sum[N], nsum[N], ans;
map <ll, int> mp;
map <int, ll> code;
void init(){
for (int i = 0; i < N; i++)
code[i] = rnd();
for (int i = 0; i < n; i++){
p[i] = i;
sz[i] = 1;
sum[i] = code[a[i]];
nsum[i] = code[b[i]];
if (sum[i] != nsum[i]){
ans += mp[nsum[i] - sum[i]];
mp[sum[i] - nsum[i]]++;
}else ans3++;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |