Submission #48148

# Submission time Handle Problem Language Result Execution time Memory
48148 2018-05-10T10:36:57 Z antimirage Library (JOI18_library) C++14
0 / 100
315 ms 384 KB
/**
	Let me ...
**/
# include <bits/stdc++.h>
# include "library.h"

#define fr first
#define sc second
#define mk make_pair
#define pb push_back
#define sz(s) (int)s.size()
#define all(s) s.begin(), s.end()

using namespace std;

const int N = 1005;

pair <int, int> ar[N];

bool used[N];

void Solve(int N)
{
    int n = N;
    vector <int> vec(n, 0), ans(n, 0);

    for (int i = 0; i < n; i++)
    {
        vec[i] = 1;
        for (int j = i + 1; j < n; j++)
        {
            vec[j] = 1;
            int res = Query(vec);

            if (res == 1)
            {
                if (ar[i].fr == 0)
                    ar[i].fr = j;
                else
                    ar[i].sc = j;

                if (ar[j].fr == 0)
                    ar[j].fr = i;
                else
                    ar[j].sc = i;
            }
            vec[j] = 0;
        }
        vec[i] = 0;
    }
    for (int i = 0; i < n; i++)
    {
        if (ar[i].sc == 0)
        {
            ans[0] = i;
            break;
        }
    }
    used[ ans[0] ] = 1;

    for (int i = 1; i < n; i++)
    {
        if (!used[ ar[ ans[i - 1] ].fr ])
        {
            ans[i] = ar[ ans[i - 1] ].fr;
            used[ ans[i] ] = 1;
        }
        else if (!used[ ar[ ans[i - 1] ].sc ])
        {
            ans[i] = ar[ ans[i - 1] ].sc;
            used[ ans[i] ] = 1;
        }
    }
    for (int i = 0; i < n; i++)
        ans[i]++;

	Answer(ans);
}

Compilation message

library.cpp: In function 'void Solve(int)':
library.cpp:74:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (int i = 0; i < n; i++)
     ^~~
library.cpp:77:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  Answer(ans);
  ^~~~~~
# Verdict Execution time Memory Grader output
1 Correct 268 ms 248 KB Output is correct
2 Correct 253 ms 308 KB Output is correct
3 Incorrect 315 ms 384 KB Wrong Answer [8]
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 268 ms 248 KB Output is correct
2 Correct 253 ms 308 KB Output is correct
3 Incorrect 315 ms 384 KB Wrong Answer [8]
4 Halted 0 ms 0 KB -