# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
223441 | cheeheng | Matching (COCI20_matching) | C++14 | 6 ms | 2688 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;
vector<int> AdjList[100005];
int X[100005];
int Y[100005];
int p[1048579];
bool visited[1048579];
bool canJoin[2005][2005];
int group[22];
bool picked[22];
int main(){
int N;
scanf("%d", &N);
for(int i = 0; i < N; i ++){
scanf("%d%d", &X[i], &Y[i]);
}
for(int i = 0; i < N; i ++){
for(int j = i+1; j < N; j ++){
if(X[i] == X[j] || Y[i] == Y[j]){
canJoin[i][j] = true;
AdjList[i].push_back(j);
AdjList[j].push_back(i);
}else{
canJoin[i][j] = false;
}
}
}
for(int i = 0; i < N/2; i ++){
group[i] = 0;
group[i+N/2] = 1;
}
printf("DA\n");
for(int i = 0; i < N; i ++){
for(int j = 0; j < N; j ++){
if(i == j){continue;}
if(picked[i] || picked[j]){
continue;
}
if(X[i] == X[j]){
picked[i] = true;
picked[j] = true;
printf("%d %d\n", i+1, j+1);
}
}
}
return 0;
}
Compilation message (stderr)
# | 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... |