Submission #1097741

#TimeUsernameProblemLanguageResultExecution timeMemory
1097741Yadav1992Art Collections (BOI22_art)C++17
100 / 100
1207 ms1832 KiB
#include <bits/stdc++.h> #include <vector> #include <art.h> using namespace std; #define ll long long #define mod 1000000007 vector<int> getInitialVector(int N) { vector<int> result(N, 0); for(int i = 1; i <= N; i++){ result[i-1] = i; } return result; } int getPosition(int prev, int cur, int N) { return (cur - prev + N)/2; } void solve(int N) { vector<int> R = getInitialVector(N); vector<int> A(N, -1); int prevCount = publish(R); for(int i = 1; i < N; i++) { int cur = R[N-1]; R.pop_back(); R.insert(R.begin(), cur); int curCount = publish(R); int position = getPosition(prevCount, curCount, N); A[position] = cur; prevCount = curCount; } for(int i = 0; i < N; i++) { if(A[i] == -1) { A[i] = 1; break; } } answer(A); }

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