Submission #467513

# Submission time Handle Problem Language Result Execution time Memory
467513 2021-08-23T12:00:42 Z LucaIlie CONSUL (info1cup19_consul) C++17
11.2087 / 100
44 ms 284 KB
//#include <stdio.h>
#include <stdlib.h>
#include <map>
#include "grader.h"

#define MAX_Q 60

using namespace std;

map <int, int> checkedPoz, checkedVal;

/*int kth( int i ) {
    int ans;

    printf( "kth %d\n", i );
    scanf( "%d", &ans );

    return ans;
}

int cnt( int x ) {
    int ans;

    printf( "cnt %d\n", x );
    scanf( "%d", &ans );

    return ans;
}

void say_answer( int ans ) {
    printf( "%d\n", ans );
}*/

void solve( int n ) {
    int q, i, x;

    checkedPoz.clear();
    checkedVal.clear();
    q = 0;
    while ( q < MAX_Q && q < n ) {
        i = rand() % n;
        if ( !checkedPoz[i] ) {
            checkedPoz[i] = 1;
            x = kth( i + 1 );
            q++;
        }

        if ( q < MAX_Q && q < n && !checkedVal[x] ) {
            checkedVal[x] = 1;
            if ( cnt( x ) > n / 3 ) {
                say_answer( x );
                return;
            }
        }
    }

    say_answer( -1 );
}

/*int main() {
    int n;

    scanf( "%d", &n );
    solve( n );

    return 0;
}*/
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 200 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Partially correct 36 ms 200 KB Output is partially correct
2 Correct 9 ms 200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Partially correct 25 ms 200 KB Output is partially correct
2 Partially correct 30 ms 200 KB Output is partially correct
3 Correct 9 ms 200 KB Output is correct
4 Correct 8 ms 200 KB Output is correct
5 Partially correct 23 ms 200 KB Output is partially correct
6 Partially correct 40 ms 200 KB Output is partially correct
7 Partially correct 29 ms 200 KB Output is partially correct
8 Partially correct 44 ms 200 KB Output is partially correct
9 Partially correct 40 ms 200 KB Output is partially correct
10 Partially correct 41 ms 200 KB Output is partially correct
11 Partially correct 42 ms 200 KB Output is partially correct
12 Partially correct 23 ms 200 KB Output is partially correct
13 Partially correct 30 ms 284 KB Output is partially correct
14 Partially correct 36 ms 200 KB Output is partially correct