Submission #1237498

#TimeUsernameProblemLanguageResultExecution timeMemory
1237498atsoukalasKutije (COCI21_kutije)C++20
70 / 70
915 ms1864 KiB
#include <bits/stdc++.h>
using namespace std;

int segment[1005];

int main() {
    int N, M, q;
    scanf("%d%d%d", &N, &M, &q);

    for(int i=1;i<=N;++i){
        segment[i] = i;
    }
    for(int i=0;i<M;++i){
        for(int j=1;j<=N;++j){
            int p; scanf("%d", &p);
            int replace = segment[p];
            segment[p] = segment[j];
            for(int k=1;k<N;++k){
                if(segment[k]==replace){
                    segment[k] = segment[j];
                }
            }
        }
    }

    for(int i=0; i<q; ++i){
        int S, G; scanf("%d%d", &S, &G);
        if(segment[S]==segment[G]) printf("DA\n");
        else printf("NE\n");
    }
    return 0;
}

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d%d%d", &N, &M, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
Main.cpp:15:25: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |             int p; scanf("%d", &p);
      |                    ~~~~~^~~~~~~~~~
Main.cpp:27:24: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |         int S, G; scanf("%d%d", &S, &G);
      |                   ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...