답안 #720690

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
720690 2023-04-08T23:55:00 Z Yell0 Kutije (COCI21_kutije) C++17
70 / 70
804 ms 14796 KB
#include <bits/stdc++.h>
 
using namespace std;
const int MN=1002;
int n,m,q;
vector<int> adj[MN];
bool vis[MN];
bool dest[MN][MN];
 
void dfs(int u,int p) {
    vis[u]=1;
    dest[p][u]=1;
    for(int v:adj[u])
        if(!vis[v])
            dfs(v,p);
}
 
int main() {
    ios::sync_with_stdio(0);cin.tie(0);
    cin>>n>>m>>q;
    for(int i=1;i<=m;i++)
        for(int u=1,v;u<=n;u++) {
            cin>>v;
            adj[v].push_back(u);
        }
	memset(dest,0,sizeof(dest));
    for(int i=1;i<=n;i++) {
        memset(vis,0,sizeof(vis));
        dfs(i,i);
    }
    int a,b;
    while(q--) {
        cin>>a>>b;
        if(dest[a][b]) cout<<"DA\n";
        else cout<<"NE\n";
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:21:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   21 |     for(int i=1;i<=m;i++)
      |     ^~~
Main.cpp:26:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   26 |  memset(dest,0,sizeof(dest));
      |  ^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 2764 KB Output is correct
2 Correct 71 ms 2604 KB Output is correct
3 Correct 65 ms 2508 KB Output is correct
4 Correct 86 ms 2868 KB Output is correct
5 Correct 72 ms 2760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1364 KB Output is correct
2 Correct 3 ms 1364 KB Output is correct
3 Correct 2 ms 1364 KB Output is correct
4 Correct 2 ms 1364 KB Output is correct
5 Correct 1 ms 1364 KB Output is correct
6 Correct 2 ms 1364 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 1 ms 1364 KB Output is correct
9 Correct 2 ms 1364 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1364 KB Output is correct
2 Correct 3 ms 1364 KB Output is correct
3 Correct 2 ms 1364 KB Output is correct
4 Correct 2 ms 1364 KB Output is correct
5 Correct 1 ms 1364 KB Output is correct
6 Correct 2 ms 1364 KB Output is correct
7 Correct 2 ms 1364 KB Output is correct
8 Correct 1 ms 1364 KB Output is correct
9 Correct 2 ms 1364 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 2 ms 1364 KB Output is correct
12 Correct 1 ms 1364 KB Output is correct
13 Correct 2 ms 1364 KB Output is correct
14 Correct 2 ms 1364 KB Output is correct
15 Correct 2 ms 1364 KB Output is correct
16 Correct 1 ms 1364 KB Output is correct
17 Correct 2 ms 1364 KB Output is correct
18 Correct 1 ms 1364 KB Output is correct
19 Correct 2 ms 1364 KB Output is correct
20 Correct 2 ms 1364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 85 ms 2764 KB Output is correct
2 Correct 71 ms 2604 KB Output is correct
3 Correct 65 ms 2508 KB Output is correct
4 Correct 86 ms 2868 KB Output is correct
5 Correct 72 ms 2760 KB Output is correct
6 Correct 2 ms 1364 KB Output is correct
7 Correct 3 ms 1364 KB Output is correct
8 Correct 2 ms 1364 KB Output is correct
9 Correct 2 ms 1364 KB Output is correct
10 Correct 1 ms 1364 KB Output is correct
11 Correct 2 ms 1364 KB Output is correct
12 Correct 2 ms 1364 KB Output is correct
13 Correct 1 ms 1364 KB Output is correct
14 Correct 2 ms 1364 KB Output is correct
15 Correct 1 ms 1364 KB Output is correct
16 Correct 2 ms 1364 KB Output is correct
17 Correct 1 ms 1364 KB Output is correct
18 Correct 2 ms 1364 KB Output is correct
19 Correct 2 ms 1364 KB Output is correct
20 Correct 2 ms 1364 KB Output is correct
21 Correct 1 ms 1364 KB Output is correct
22 Correct 2 ms 1364 KB Output is correct
23 Correct 1 ms 1364 KB Output is correct
24 Correct 2 ms 1364 KB Output is correct
25 Correct 2 ms 1364 KB Output is correct
26 Correct 216 ms 7260 KB Output is correct
27 Correct 147 ms 7164 KB Output is correct
28 Correct 630 ms 6636 KB Output is correct
29 Correct 464 ms 7360 KB Output is correct
30 Correct 136 ms 6608 KB Output is correct
31 Correct 127 ms 6780 KB Output is correct
32 Correct 804 ms 7244 KB Output is correct
33 Correct 147 ms 14412 KB Output is correct
34 Correct 205 ms 14412 KB Output is correct
35 Correct 148 ms 14796 KB Output is correct