Submission #261806

# Submission time Handle Problem Language Result Execution time Memory
261806 2020-08-12T05:33:57 Z dantoh000 Colors (RMI18_colors) C++14
7 / 100
141 ms 3960 KB
#include <bits/stdc++.h>
using namespace std;
int n,m;
int a[150005], b[150005];
vector<int> G[150005];
int main(){
    int tc;
    scanf("%d",&tc);
    while (tc--){
        scanf("%d%d",&n,&m);
        for (int i = 1; i <= n; i++){
            G[i].clear();
            scanf("%d",&a[i]);
        }
        for (int i = 1; i <= n; i++){
            scanf("%d",&b[i]);
        }
        for (int i = 1; i <= m; i++){
            int u,v;
            scanf("%d%d",&u,&v);
            G[u].push_back(v);
            G[v].push_back(u);
        }
        int ans=1;
        for (int i = 1; i <= n; i++){
            if (a[i] != b[i]){
                if (b[i] > a[i]){
                    ans =0;
                }
                else{
                    int found = 0;
                    for (int j = 1; j <= n; j++){
                        if (a[j] == b[i]) found = 1;
                    }
                    if (!found) ans = 0;
                }
            }
        }
        printf("%d\n",ans);
    }
}

Compilation message

colors.cpp: In function 'int main()':
colors.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&tc);
     ~~~~~^~~~~~~~~~
colors.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&n,&m);
         ~~~~~^~~~~~~~~~~~~~
colors.cpp:13:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d",&a[i]);
             ~~~~~^~~~~~~~~~~~
colors.cpp:16:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d",&b[i]);
             ~~~~~^~~~~~~~~~~~
colors.cpp:20:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d%d",&u,&v);
             ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 3840 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 69 ms 3840 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 3840 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 3840 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 3840 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 141 ms 3960 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 33 ms 3840 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 66 ms 3840 KB Output isn't correct
2 Halted 0 ms 0 KB -