Submission #775464

#TimeUsernameProblemLanguageResultExecution timeMemory
775464PagodePaivaArt Collections (BOI22_art)C++17
100 / 100
1402 ms956 KiB
#include "art.h" #include<bits/stdc++.h> using namespace std; void solve(int N) { int n = N; vector <int> v; for(int i = 1;i <= n;i++){ v.push_back(i); } int valant = publish(v); map <int, int> m; map <int, int> resp; for(int a = 0, b = n-1, i = 1;i <= n;a++, b--, i++){ m[a-b] = i; } for(int i = 1;i < n;i++){ v.clear(); for(int j = i+1;j <= n;j++){ v.push_back(j); } for(int j = 1;j <= i;j++){ v.push_back(j); } int val = publish(v); resp[i] = m[valant - val]; valant = val; } int mark[n+1]; for(int i = 1;i <= n;i++) mark[i] = 0; vector <pair <int, int>> res; for(int i = 1;i < n;i++){ res.push_back({resp[i], i}); mark[resp[i]] = 1; } for(int i = 1;i <= n;i++){ if(mark[i] == 0){ res.push_back({i, n}); break; } } sort(res.begin(), res.end()); vector <int> final; for(int i = 0;i < n;i++){ final.push_back(res[i].second); } answer(final); return; }

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