답안 #673858

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
673858 2022-12-22T09:49:16 Z gesgha Art Collections (BOI22_art) C++17
0 / 100
1 ms 208 KB
#include <bits/stdc++.h>
#include "art.h"

#define fr(i, a, b) for (int i = a; i <= b; ++i)
#define rf(i, a, b) for (int i = a; i >= b; --i)
#define fe(x, y) for (auto& x : y)

#define fi first
#define se second
#define pb push_back

#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define pw(x) (1LL << (x))

using namespace std;

template <typename T>
using ve = vector < T >;

template <typename T>
bool umx(T& a, T b) {return a < b ? a = b, 1 : 0;}

template <typename T>
bool umn(T& a, T b) {return a > b ? a = b, 1 : 0;}

using ll = long long;
using pll = pair <ll, ll>;
using pii = pair <int, int>;

const int N = 2e5 + 100;
const int oo = 1e9 + 10;
const ll OO = 1e18 + 100;


vector<int> order;

int pos[N];

bool cmp(int a, int b) {
    int x = publish(order);
    swap(order[pos[a]], order[pos[b]]);
    int y = publish(order);
    swap(order[pos[a]], order[pos[b]]);
    if (x > y) swap(pos[a], pos[b]);
    return x > y;
}

void solve(int n) {
    order.resize(n, 0);
    iota(all(order), 1);
    int val = publish(order);
    for (int i = 1; i <= n; ++i) pos[i] = i - 1;
    sort(all(order), cmp);

//    for (int i = 0; i < n; i++) {
//        for (int j = i + 1; j < n; j++) {
//            swap(order[i], order[j]);
//            int x = publish(order);
//            if (val > x) {
//                val = x;
//            } else swap(order[i], order[j]);
//        }
//    }
    answer(order);
}

Compilation message

art.cpp: In function 'void solve(int)':
art.cpp:52:9: warning: unused variable 'val' [-Wunused-variable]
   52 |     int val = publish(order);
      |         ^~~
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 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -