Submission #647344

#TimeUsernameProblemLanguageResultExecution timeMemory
647344PetyArt Collections (BOI22_art)C++17
100 / 100
1591 ms832 KiB
#include <bits/stdc++.h>
#include "art.h"
#define ll long long

using namespace std;

const int INF = 1e9;
const int MOD = 1e9 + 7;


void solve(int N) {
  vector<int>R;
  for (int i = 1; i <= N; i++)
    R.push_back(i);
  int value = publish(R);
  vector<int>ans = {1};
  for (int i = 2; i <= N; i++) {
    vector<int>R2 = {i};
    for (int j = 1; j <= N; j++)
      if (j != i) {
        R2.push_back(j);
      }
    int value2 = publish(R2);
    ///x + y = i - 1
    ///x - y = value - value2
    ///x-->alea mai jos, y-->alea mai sus
    int x = (i - 1 + value - value2) / 2;
    int y = i - 1 - x;
    ans.push_back(0);
    for (int j = ans.size() - 2; j >= y; j--)
      ans[j + 1] = ans[j];
    ans[y] = i;
  }
  answer(ans);
}

Compilation message (stderr)

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...