제출 #724513

#제출 시각아이디문제언어결과실행 시간메모리
724513TheSahibKutije (COCI21_kutije)C++14
35 / 70
1081 ms17292 KiB
#include <bits/stdc++.h>
 
#pragma GCC optimize("O3")
 
#define ll long long
#define oo 1e9 + 9
#define pii pair<ll, ll>
 
using namespace std;

const int MAX = 1005; 

int n, m, q;
int g[MAX][MAX];
int dist[MAX][MAX];

bool visited[MAX];
void dfs(int node, int p){
    visited[node] = 1;
    dist[p][node] = 1;
    for (int i = 1; i <= n; i++)
    {
        if(g[node][i] && !visited[i]){
            dfs(i, p);
        }
    }
    
}


int main(){
    cin >> n >> m >> q;
    for (int i = 0; i < m; i++)
    {
        for (int j = 1; j <= n; j++)
        {
            int a; scanf("%d", &a);
            g[j][a] = 1;
        }
    }
    for (int i = 1; i <= n; i++)
    {
        memset(visited, 0, sizeof(visited));
        dfs(i, i);
    }
    while(q--){
        int a, b; scanf("%d %d", &a, &b);
        if(dist[a][b]){
            cout << "DA\n";
        }
        else{
            cout << "NE\n";
        }
    }
}

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

Main.cpp: In function 'int main()':
Main.cpp:37:25: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |             int a; scanf("%d", &a);
      |                    ~~~~~^~~~~~~~~~
Main.cpp:47:24: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   47 |         int a, b; scanf("%d %d", &a, &b);
      |                   ~~~~~^~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...