답안 #505160

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
505160 2022-01-10T19:57:08 Z nicecoder37 Kutije (COCI21_kutije) C++17
35 / 70
1000 ms 10404 KB
/*MKAAN THE KING*/
#include <bits/stdc++.h>
#define space " "
#define endl "\n"
#define gcd __gcd
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define inf 1000000000
#define md 1000000007
#define li 1005
#define lo long long
using namespace std;
int n,m,Q,x,y,a,vis[li][li];
vector<int> v[li];
void dfs(int sayi,int node){
	if(vis[sayi][node]) return ;
	vis[sayi][node]=1;
	for(int i=0;i<(int)v[node].size();i++){
		int go=v[node][i];
		//~ printf("")
		if(vis[sayi][go]) continue;
		dfs(sayi,go);
	}
}
int main(){
	scanf("%d %d %d",&n,&m,&Q);
	for(int i=1;i<=m;i++){
		for(int j=1;j<=n;j++){
			scanf("%d",&a);
			v[a].pb(j);
		}
	}
	for(int i=1;i<=n;i++) dfs(i,i);
	while(Q--){
		scanf("%d %d",&x,&y);
		if(vis[x][y]) printf("DA\n");
		else printf("NE\n");
	}
	return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:29:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |  scanf("%d %d %d",&n,&m,&Q);
      |  ~~~~~^~~~~~~~~~~~~~~~~~~~~
Main.cpp:32:9: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |    scanf("%d",&a);
      |    ~~~~~^~~~~~~~~
Main.cpp:38:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   38 |   scanf("%d %d",&x,&y);
      |   ~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 151 ms 5928 KB Output is correct
2 Correct 131 ms 5460 KB Output is correct
3 Correct 110 ms 5196 KB Output is correct
4 Correct 117 ms 5952 KB Output is correct
5 Correct 147 ms 5828 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 716 KB Output is correct
2 Correct 1 ms 716 KB Output is correct
3 Correct 2 ms 716 KB Output is correct
4 Correct 2 ms 716 KB Output is correct
5 Correct 1 ms 716 KB Output is correct
6 Correct 2 ms 716 KB Output is correct
7 Correct 3 ms 776 KB Output is correct
8 Correct 1 ms 716 KB Output is correct
9 Correct 2 ms 716 KB Output is correct
10 Correct 1 ms 716 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 716 KB Output is correct
2 Correct 1 ms 716 KB Output is correct
3 Correct 2 ms 716 KB Output is correct
4 Correct 2 ms 716 KB Output is correct
5 Correct 1 ms 716 KB Output is correct
6 Correct 2 ms 716 KB Output is correct
7 Correct 3 ms 776 KB Output is correct
8 Correct 1 ms 716 KB Output is correct
9 Correct 2 ms 716 KB Output is correct
10 Correct 1 ms 716 KB Output is correct
11 Correct 2 ms 716 KB Output is correct
12 Correct 2 ms 716 KB Output is correct
13 Correct 2 ms 716 KB Output is correct
14 Correct 3 ms 716 KB Output is correct
15 Correct 2 ms 764 KB Output is correct
16 Correct 2 ms 716 KB Output is correct
17 Correct 3 ms 716 KB Output is correct
18 Correct 1 ms 716 KB Output is correct
19 Correct 2 ms 716 KB Output is correct
20 Correct 2 ms 748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 151 ms 5928 KB Output is correct
2 Correct 131 ms 5460 KB Output is correct
3 Correct 110 ms 5196 KB Output is correct
4 Correct 117 ms 5952 KB Output is correct
5 Correct 147 ms 5828 KB Output is correct
6 Correct 2 ms 716 KB Output is correct
7 Correct 1 ms 716 KB Output is correct
8 Correct 2 ms 716 KB Output is correct
9 Correct 2 ms 716 KB Output is correct
10 Correct 1 ms 716 KB Output is correct
11 Correct 2 ms 716 KB Output is correct
12 Correct 3 ms 776 KB Output is correct
13 Correct 1 ms 716 KB Output is correct
14 Correct 2 ms 716 KB Output is correct
15 Correct 1 ms 716 KB Output is correct
16 Correct 2 ms 716 KB Output is correct
17 Correct 2 ms 716 KB Output is correct
18 Correct 2 ms 716 KB Output is correct
19 Correct 3 ms 716 KB Output is correct
20 Correct 2 ms 764 KB Output is correct
21 Correct 2 ms 716 KB Output is correct
22 Correct 3 ms 716 KB Output is correct
23 Correct 1 ms 716 KB Output is correct
24 Correct 2 ms 716 KB Output is correct
25 Correct 2 ms 748 KB Output is correct
26 Correct 299 ms 10280 KB Output is correct
27 Correct 207 ms 10404 KB Output is correct
28 Correct 941 ms 9384 KB Output is correct
29 Correct 682 ms 10184 KB Output is correct
30 Correct 155 ms 9028 KB Output is correct
31 Correct 193 ms 9244 KB Output is correct
32 Execution timed out 1077 ms 9132 KB Time limit exceeded
33 Halted 0 ms 0 KB -