Submission #587855

#TimeUsernameProblemLanguageResultExecution timeMemory
5878551zaid1Art Collections (BOI22_art)C++17
20 / 100
133 ms1256 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; int sum = 0; map<pair<int, int>, int> vis, mp; int done(int &a, int &b, vector<int>& v) { if (!vis[{a, b}]) { vis[{a, b}] = 1; vis[{b, a}] = 1; swap(a, b); int now = publish(v); swap(a, b); mp[{a, b}] = (sum-now) < 0; mp[{b, a}] = !mp[{a, b}]; }return mp[{a, b}]; } void solve(int n) { vector<int> v(n, 0), vis(n, 1); for (int i = 0; i < n; i++) v[i] = i+1; sum = publish(v); while (sum) { for (int i = 0; i < n-1; i++) { if (!done(v[i], v[i+1], v)) { swap(v[i], v[i+1]); sum--; } } } answer(v); }

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