# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
18566 | choyi0521 | 역사적 조사 (JOI14_historical) | C++14 | 4000 ms | 202456 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<stdio.h>
#include<queue>
#include<map>
#include<algorithm>
using namespace std;
typedef long long ll;
const int MAX_N=1e5,MAX_Q = 1e5;
int n, q,a[MAX_N+1],rtn;
ll res[MAX_Q];
priority_queue<pair<ll, int>> pq;
map<int, int> mp;
struct st {
int x, y, idx;
bool operator<(st i) const{
return x / rtn*rtn + y / rtn<i.x/rtn*rtn+i.y/rtn;
}
}query[MAX_Q];
void add(int x) {
pq.push({ (ll)x*++mp[x],x });
}
int main() {
scanf("%d %d", &n, &q);
rtn = sqrt(n);
for (int i = 1; i <=n; i++) scanf("%d", &a[i]);
for (int i = 0; i < q; i++) {
scanf("%d %d", &query[i].x, &query[i].y);
query[i].idx = i;
}
sort(query, query + q);
int s=0, e = -1;
# | 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... |