Submission #1098864

#TimeUsernameProblemLanguageResultExecution timeMemory
1098864epicci23Art Collections (BOI22_art)C++17
100 / 100
1293 ms1192 KiB
#include "bits/stdc++.h" #include "art.h" //#define int long long #define all(v) v.begin() , v.end() #define sz(a) (int)a.size() using namespace std; void solve(int n){ vector<int> ans(n, -1); vector<int> cur; for(int j = 1; j <= n; j++) cur.push_back(j); int xd = publish(cur), agla = 0; for(int i = 1; i < n; i++){ vector<int> v; for(int j = 1; j <= i; j++) v.push_back(j); for(int j = n; j > i; j--) v.push_back(j); int hm = xd + publish(v); hm -= agla * 2; hm -= (n-i) * (n-1-i) / 2; hm /= 2; int koy; for(int j=0;j<n;j++){ if(ans[j]!=-1) continue; if(hm==0){ ans[j]=i; koy=j; break; } hm--; } for(int j=0;j<koy;j++) if(ans[j]==-1) agla++; } for(int i=0;i<n;i++){ if(ans[i]==-1){ ans[i]=n; break; } } answer(ans); } /*void _(){ } int32_t main(){ cin.tie(0); ios::sync_with_stdio(0); int tc=1;//cin >> tc; while(tc--) _(); return 0; }*/

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:21:8: warning: 'koy' may be used uninitialized in this function [-Wmaybe-uninitialized]
   21 |    int koy;
      |        ^~~
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...