Submission #499513

# Submission time Handle Problem Language Result Execution time Memory
499513 2021-12-28T14:24:48 Z adam Lampice (COCI21_lampice) C++14
0 / 50
0 ms 204 KB
#include <iostream>

using namespace std;

int main()
{
   int n,k;
   int p;
   bool o=0;
   cin>>n>>k;
   int a[n];
   for(int i=0;i<n;i++){
    cin>>a[i];
    }int sum=0;
    for(int i=0;i<n;i++){
    if(a[i]==a[i-1]){sum++;p=a[i];}
    if(sum==k){o=1;break;}
    }
    if(o==1)cout<<p<<endl<<'1';
    else cout<<"-1";
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:19:19: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |     if(o==1)cout<<p<<endl<<'1';
      |                   ^
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -