Submission #315029

# Submission time Handle Problem Language Result Execution time Memory
315029 2020-10-22T01:00:18 Z daniel920712 CONSUL (info1cup19_consul) C++14
0 / 100
2 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)
        {
            xx=cnt(t);
            big=max(big,xx);
            n-=(xx-10);
        }
        big=max(big,all[t]);
        if(all[t]>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:22: warning: unused variable 'x' [-Wunused-variable]
    7 |     int i,t,big,xx=n,x;
      |                      ^
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 1 ms 256 KB Wrong answer
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 256 KB Wrong answer
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 256 KB Wrong answer
2 Halted 0 ms 0 KB -