Submission #714979

#TimeUsernameProblemLanguageResultExecution timeMemory
714979vjudge1Art Collections (BOI22_art)C++17
70 / 100
1622 ms704 KiB
#include "art.h" #include<bits/stdc++.h> using namespace std; // g++ -std=c++17 art_sample.cpp sample_grader.cpp int n; int f_p(int a){ vector<int> order; for (int i = 1; i <= n; i++) { if(i == a) continue; order.push_back(i); } order.push_back(a); return publish(order); } int f_q(int a){ vector<int> order; order.push_back(a); for (int i = 1; i <= n; i++) { if(i == a) continue; order.push_back(i); } return publish(order); } void solve(int N) { n = N; vector<int> ans(n, 0); for (int i = 1; i <= n; i++) { int p = f_p(i); int q = f_q(i); /* p = x + n - 1 - pos(i); q = pos(i) + x; p - q = n - 1 - 2 * pos(i); pos(i) = (n - 1 - (p - q)) / 2; */ //cout << p << " " << q << endl; int pos = (n - 1 - (p - q)) / 2; ans[pos] = 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...