답안 #521079

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
521079 2022-01-31T17:19:05 Z LucaIlie Mouse (info1cup19_mouse) C++17
0 / 100
1 ms 200 KB
#include <bits/stdc++.h>
#include "grader.h"

using namespace std;

int tried[256][256];

void solve( int n ) {
    int a, b, i, j, k;
    vector <int> q, val, poz;

    if ( n == 1 ) {
        query( { 1 } );
        return;
    }
    if ( n == 2 ) {
        if ( query( { 1, 2 } ) == 0 )
            query( { 2, 1 } );
        return;
    }

    for ( i = 1; i <= n; i++ ) {
        q.push_back( i );
        val.push_back( -1 );
        poz.push_back( -1 );
    }

    while ( query( q ) > 0 )
        random_shuffle( q.begin(), q.end() );

    /*for ( i = 0; i < n; i++ ) {
        if ( val[i] == -1 ) {
            for ( j = 0; j < n; j++ ) {
                if ( i != j && val[j] == -1 && !tried[i][j] ) {
                    tried[i][j] = 1;
                    swap( q[i], q[j] );
                    a = query( q );
                    if ( a == 2 ) {
                        val[i] = q[j];
                        val[j] = q[i];
                    } else if ( a == 1 ) {
                        k = ((i + 1 < n && i + 1 != j) ? i + 1 : (i + 2 < n && i + 2 != j ? i + 2 : (i - 1 >= 0 && i - 1 != j ? i - 1 : i - 2)));
                        swap( q[i], q[k] );
                        a = query( q );

                    }
                }
            }
        }
    }*/

    query( val );
}

Compilation message

mouse.cpp: In function 'void solve(int)':
mouse.cpp:9:9: warning: unused variable 'a' [-Wunused-variable]
    9 |     int a, b, i, j, k;
      |         ^
mouse.cpp:9:12: warning: unused variable 'b' [-Wunused-variable]
    9 |     int a, b, i, j, k;
      |            ^
mouse.cpp:9:18: warning: unused variable 'j' [-Wunused-variable]
    9 |     int a, b, i, j, k;
      |                  ^
mouse.cpp:9:21: warning: unused variable 'k' [-Wunused-variable]
    9 |     int a, b, i, j, k;
      |                     ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Integer -1 violates the range [1, 7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Integer -1 violates the range [1, 7]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 200 KB Integer -1 violates the range [1, 7]
2 Halted 0 ms 0 KB -