Submission #874056

#TimeUsernameProblemLanguageResultExecution timeMemory
874056WongYiKaiFriend (IOI14_friend)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int findSample(int n, int confidence[], int host[], int protocol[]){ int n,temp,temp2,test = 0,high = 0; for (int i=0;i<n;i++){ temp = confidence[i]; high = max(high,temp); } for (int i=1;i<n;i++){ if (protocol[i] != 2) test = 1; } if (test == 0){ return high; } }

Compilation message (stderr)

friend.cpp: In function 'int findSample(int, int*, int*, int*)':
friend.cpp:5:8: error: declaration of 'int n' shadows a parameter
    5 |    int n,temp,temp2,test = 0,high = 0;
      |        ^
friend.cpp:4:20: note: 'int n' previously declared here
    4 | int findSample(int n, int confidence[], int host[], int protocol[]){
      |                ~~~~^
friend.cpp:5:15: warning: unused variable 'temp2' [-Wunused-variable]
    5 |    int n,temp,temp2,test = 0,high = 0;
      |               ^~~~~
friend.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type]
   16 | }
      | ^