Submission #799847

# Submission time Handle Problem Language Result Execution time Memory
799847 2023-08-01T06:24:33 Z n3rm1n CONSUL (info1cup19_consul) C++17
0 / 100
36 ms 308 KB
#include<bits/stdc++.h>
#include "grader.h"
#define endl '\n'
using namespace std;

void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
}

void solve(int N)
{
    map < int, int > checked;
    int atleast = N/3 + 1;
    vector < int > index;
    for (int i = 1; i <= N; ++ i)
        index.push_back(i);
    random_shuffle(index.begin(), index.end());
    for (int i = 0; i < index.size(); ++ i)
    {
        int x = kth(index[i]);
        if(checked[x])continue;
        else if(cnt(x) >= atleast)
        {
            say_answer(x);
            return;
        }
    }
    say_answer(-1);
}

Compilation message

consul.cpp: In function 'void solve(int)':
consul.cpp:21:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |     for (int i = 0; i < index.size(); ++ i)
      |                     ~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 36 ms 208 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 308 KB Too many queries
2 Halted 0 ms 0 KB -