이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
using namespace std;
int gr_nr = 0;
vector<vector<int>> groups;
vector<int> vals;
void ds_gr(int a, int b){
if (a==b) return;
int m = (a+(b-a+1)/2);
for (int i=a; i<m; i++){
for (int j=m; j<=b; j++){
groups[i][j] = gr_nr;
}
}
vals[gr_nr] = (m-a)*(b-m+1);
gr_nr++;
ds_gr(a, m-1); ds_gr(m, b);
}
void initialize(int n){
groups.resize(n, vector<int> (n,0));
vals.resize(n, 0);
ds_gr(0, n-1);
}
int hasEdge(int u, int v){
return !(--vals[groups[min(u,v)][max(u,v)]]);
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |