Submission #48147

#TimeUsernameProblemLanguageResultExecution timeMemory
48147antimirageLibrary (JOI18_library)C++14
Compilation error
0 ms0 KiB
/**
	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()

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 (stderr)

library.cpp:16:1: error: 'pair' does not name a type; did you mean 'wait'?
 pair <int, int> ar[N];
 ^~~~
 wait
library.cpp: In function 'void Solve(int)':
library.cpp:23:5: error: 'vector' was not declared in this scope
     vector <int> vec(n, 0), ans(n, 0);
     ^~~~~~
library.cpp:23:5: note: suggested alternative:
In file included from /usr/include/c++/7/vector:64:0,
                 from /usr/include/c++/7/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:86,
                 from library.cpp:4:
/usr/include/c++/7/bits/stl_vector.h:216:11: note:   'std::vector'
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
library.cpp:23:13: error: expected primary-expression before 'int'
     vector <int> vec(n, 0), ans(n, 0);
             ^~~
library.cpp:27:9: error: 'vec' was not declared in this scope
         vec[i] = 1;
         ^~~
library.cpp:27:9: note: suggested alternative: 'getc'
         vec[i] = 1;
         ^~~
         getc
library.cpp:35:21: error: 'ar' was not declared in this scope
                 if (ar[i].fr == 0)
                     ^~
library.cpp:35:21: note: suggested alternative: 'fr'
                 if (ar[i].fr == 0)
                     ^~
                     fr
library.cpp:40:21: error: 'ar' was not declared in this scope
                 if (ar[j].fr == 0)
                     ^~
library.cpp:40:21: note: suggested alternative: 'fr'
                 if (ar[j].fr == 0)
                     ^~
                     fr
library.cpp:51:13: error: 'ar' was not declared in this scope
         if (ar[i].sc == 0)
             ^~
library.cpp:51:13: note: suggested alternative: 'fr'
         if (ar[i].sc == 0)
             ^~
             fr
library.cpp:53:13: error: 'ans' was not declared in this scope
             ans[0] = i;
             ^~~
library.cpp:53:13: note: suggested alternative: 'abs'
             ans[0] = i;
             ^~~
             abs
library.cpp:57:11: error: 'ans' was not declared in this scope
     used[ ans[0] ] = 1;
           ^~~
library.cpp:57:11: note: suggested alternative: 'abs'
     used[ ans[0] ] = 1;
           ^~~
           abs
library.cpp:61:20: error: 'ar' was not declared in this scope
         if (!used[ ar[ ans[i - 1] ].fr ])
                    ^~
library.cpp:61:20: note: suggested alternative: 'fr'
         if (!used[ ar[ ans[i - 1] ].fr ])
                    ^~
                    fr
library.cpp:72:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (int i = 0; i < n; i++)
     ^~~
library.cpp:75:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  Answer(ans);
  ^~~~~~