Submission #718005

#TimeUsernameProblemLanguageResultExecution timeMemory
718005fatemetmhrArt Collections (BOI22_art)C++17
100 / 100
1637 ms736 KiB
// Be name khoda // #include "art.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; #define all(x) x.begin(), x.end() #define pb push_back #define fi first #define se second const int maxn5 = 4e3 + 10; vector <int> av, tmp; void solve(int n){ for(int i = 0; i < n; i++) av.pb(i + 1); av.shrink_to_fit(); tmp.resize(n); tmp.shrink_to_fit(); int ans1, ans2; ans1 = publish(av); //cout << "here " << n << endl; for(int i = 1; i < n; i++){ //cout << "ok " << i << endl; int pt = 1; tmp[0] = i + 1; for(int j = 0; j < n; j++) if(av[j] != i + 1) tmp[pt++] = av[j]; ans2 = publish(tmp); int x = (i + (ans1 - ans2)) / 2; int y = i - x; pt = 0; for(int j = 0; j < n; j++) if(tmp[j] != i + 1){ if(pt == y) av[pt++] = (i + 1); av[pt++] = tmp[j]; } if(pt == y) av[pt++] = (i + 1); ans1 -= x; } answer(av); }

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