제출 #223441

#제출 시각아이디문제언어결과실행 시간메모리
223441cheehengMatching (COCI20_matching)C++14
5 / 110
6 ms2688 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

matching.cpp: In function 'int main()':
matching.cpp:19:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &N);
     ~~~~~^~~~~~~~~~
matching.cpp:22:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d", &X[i], &Y[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...