Submission #315030

# Submission time Handle Problem Language Result Execution time Memory
315030 2020-10-22T01:01:08 Z daniel920712 CONSUL (info1cup19_consul) C++14
0 / 100
0 ms 256 KB
#include "grader.h"
#include <map>
using namespace std;
map < int , int > all;
void solve(int n)
{
    int i,t,big,xx=n,x;
    for(i=1;i<=n;i++)
    {
        t=kth(i);
        all[t]++;
        if(all[t]==10)
        {
            x=cnt(t);
            big=max(big,x);
            xx-=(x-10);
        }
        big=max(big,all[t]);
        if(big>n/3)
        {
            say_answer(t);
            return;
        }
        if(big+(xx-i)<=n/3)
        {
            say_answer(-1);
            return;
        }
    }
    say_answer(-1);
}

Compilation message

consul.cpp: In function 'void solve(int)':
consul.cpp:7:13: warning: 'big' may be used uninitialized in this function [-Wmaybe-uninitialized]
    7 |     int i,t,big,xx=n,x;
      |             ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Wrong answer
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Wrong answer
2 Halted 0 ms 0 KB -