Submission #924816

#TimeUsernameProblemLanguageResultExecution timeMemory
924816mdobricArt Collections (BOI22_art)C++17
100 / 100
1268 ms1644 KiB
#include <bits/stdc++.h> using namespace std; int red[4005], red_in[4005]; vector <int> r, r2; void answer (vector <int> v);/*{ for (int i = 0; i < v.size(); i++){ cout << v[i] << " "; } cout << "\n"; return; }*/ int publish (vector <int> v);/*{ cout << "? "; for (int i = 0; i < v.size(); i++){ cout << v[i] << " "; } cout << endl; int ans; cin >> ans; return ans; }*/ void solve (int n){ for (int i = 1; i <= n; i++){ r.push_back(i); r2.push_back(i); } int prosli = publish(r); int prvi = prosli; for (int i = 1; i < n; i++){ r.clear(); for (int j = 1; j < r2.size(); j++){ r.push_back(r2[j]); } r.push_back(i); int x = publish(r); red[i] = (n - 1 - x + prosli) / 2; red[i]++; red_in[red[i]] = i; //cout << i << " " << red[i] << endl; prosli = x; r2.clear(); for (int j = 0; j < r.size(); j++){ r2.push_back(r[j]); } } red[n] = (n - 1 - prvi + prosli) / 2; red[n]++; red_in[red[n]] = n; r.clear(); for (int i = 1; i <= n; i++){ //cout << red_in[i] << endl; r.push_back(red_in[i]); } answer(r); } /* int main (void){ solve(4); return 0; }*/

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:35:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |   for (int j = 1; j < r2.size(); j++){
      |                   ~~^~~~~~~~~~~
art.cpp:48:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |   for (int j = 0; j < r.size(); j++){
      |                   ~~^~~~~~~~~~
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...