Submission #720163

#TimeUsernameProblemLanguageResultExecution timeMemory
720163gagik_2007Art Collections (BOI22_art)C++17
100 / 100
1686 ms664 KiB
#include "art.h"
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <chrono>
#include <ctime>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <limits>
#include <iomanip>
#include <unordered_set>
#include <unordered_map>
#include <fstream>
#include <functional>
#include <random>
#include <cassert>
using namespace std;

typedef long long ll;
typedef long double ld;

#define ff first
#define ss second

ll ttt;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ll N = 1000007;
ll n, m, k;

void solve(int NN) {
    n = NN;
    vector<int>p;
    for (int i = 1; i <= n; i++) {
        p.push_back(i);
    }
    vector<int>ans(n, -1);
    int lst = publish(p);
    int cur = n;
    for (int i = 1; i < n; i++) {
        p.insert(p.begin(), p.back());
        p.pop_back();
        int vl = publish(p);
        int x = lst - vl;
        ans[(x + n - 1) / 2] = cur;
        cur--;
        lst = vl;
    }
    reverse(ans.begin(), ans.end());
    for (int i = 0; i < ans.size(); i++) {
        if (ans[i] == -1) {
            ans[i] = cur;
            break;
        }
    }
    answer(ans);
}

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:55:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |     for (int i = 0; i < ans.size(); i++) {
      |                     ~~^~~~~~~~~~~~
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) {
      |        ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...