Submission #581253

#TimeUsernameProblemLanguageResultExecution timeMemory
581253MeloricArt Collections (BOI22_art)C++17
100 / 100
1570 ms700 KiB
#include <bits/stdc++.h> #include "art.h" #define pb push_back //#define int int64_t #define pii pair<int, int> #define X first #define Y second #define all(x) (x).begin(),(x).end() #define lb lower_bound #define ub upper_bound using namespace std; //const int inf = 1e18; void p(auto A){ for(auto e : A)cout << e << ' '; cout << '\n'; } vector<int> gen(int a, int N){ vector<int> ret; ret.pb(a); for(int i = 1; i<= N; i++){ if(i == a)continue; ret.pb(i); } return ret; } void solve(int N){ int x = publish(gen(1, N)); vector<int> A(N+1); for(int i = 2; i<= N; i++)A[i] = (publish(gen(i, N))-(x-i+1))/2; vector<int> ans; priority_queue<int> pq; for(int i = 1; i<= N; i++)if(A[i] == 0)pq.push(i); while(pq.size()){ int c = pq.top(); pq.pop(); ans.pb(c); for(int i = c; i<= N; i++){ A[i]--; if(A[i] == 0)pq.push(i); } } answer(ans); } /* signed main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int t = 1; //cin >> t; while(t--)solve(); } */

Compilation message (stderr)

art.cpp:16:8: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   16 | void p(auto A){
      |        ^~~~
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...