답안 #705610

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
705610 2023-03-04T19:26:11 Z Username4132 Kutije (COCI21_kutije) C++14
70 / 70
229 ms 13920 KB
#include<iostream>
#include<vector>
using namespace std;
#define forn(i, n) for(int i=0; i<(int)n; ++i)
#define PB push_back

const int MAXN=1010;
int n, m, q, com[MAXN], stat;
vector<int> g[MAXN];

void dfs(int v){
    com[v]=stat;
    for(auto to:g[v]) if(!com[to]) dfs(to);
}

int main(){
    scanf("%d %d %d", &n, &m, &q);
    forn(f, m) forn(i, n){
        int a; scanf("%d", &a);
        g[a-1].PB(i);
    }
    forn(i, n) if(!com[i]) ++stat, dfs(i);
    forn(i, q){
        int a, b; scanf("%d %d", &a, &b);
        printf("%s", com[a-1]==com[b-1]? "DA\n" : "NE\n");
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |     scanf("%d %d %d", &n, &m, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:19:21: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   19 |         int a; scanf("%d", &a);
      |                ~~~~~^~~~~~~~~~
Main.cpp:24:24: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   24 |         int a, b; scanf("%d %d", &a, &b);
      |                   ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 121 ms 5580 KB Output is correct
2 Correct 101 ms 4936 KB Output is correct
3 Correct 116 ms 4684 KB Output is correct
4 Correct 115 ms 5608 KB Output is correct
5 Correct 114 ms 5544 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 336 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 2 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 2 ms 340 KB Output is correct
17 Correct 2 ms 344 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 2 ms 344 KB Output is correct
20 Correct 2 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 121 ms 5580 KB Output is correct
2 Correct 101 ms 4936 KB Output is correct
3 Correct 116 ms 4684 KB Output is correct
4 Correct 115 ms 5608 KB Output is correct
5 Correct 114 ms 5544 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 2 ms 336 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 2 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 336 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 1 ms 340 KB Output is correct
19 Correct 1 ms 340 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 2 ms 340 KB Output is correct
22 Correct 2 ms 344 KB Output is correct
23 Correct 2 ms 340 KB Output is correct
24 Correct 2 ms 344 KB Output is correct
25 Correct 2 ms 340 KB Output is correct
26 Correct 201 ms 13880 KB Output is correct
27 Correct 229 ms 13920 KB Output is correct
28 Correct 185 ms 11980 KB Output is correct
29 Correct 206 ms 13512 KB Output is correct
30 Correct 175 ms 11816 KB Output is correct
31 Correct 174 ms 11992 KB Output is correct
32 Correct 226 ms 13420 KB Output is correct
33 Correct 199 ms 13448 KB Output is correct
34 Correct 201 ms 13496 KB Output is correct
35 Correct 206 ms 13900 KB Output is correct