#include <bits/stdc++.h>
#include "art.h"
using namespace std;
#define pb push_back
#define pi pair<int, int>
#define endl '\n'
#define all(v) v.begin(), v.end()
#define fr(m,n,k) for(int m=n;m<=k;m++)
#define vi vector<int>
int n;
void solve(int N) {
cin >> n;
vector<int> v; fr(i, 1, n) v.pb(i);
vector<pi> is;
int has[n + 1] = {};
fr(i, 1, n) {
has[i] = publish(v);
int x = *v.begin();
v.pb(x); v.erase(v.begin());
}
has[0] = has[n];
fr(i, 1, n) {
is.pb({has[i] - has[i - 1], i - 1});
}
sort(is.rend(), is.rbegin());
vi an(n);
fr(i, 0, n - 1) {
auto [_, pos] = is[i];
an[i] = pos;
}
answer(an);
}
Compilation message
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
20 | if(v.size() != N) {
| ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
36 | if(v.size() != N) {
| ~~~~~~~~~^~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
0 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
0 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
0 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
0 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
0 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
0 ms |
344 KB |
Time limit exceeded (wall clock) |
2 |
Halted |
0 ms |
0 KB |
- |