Submission #581249

#TimeUsernameProblemLanguageResultExecution timeMemory
581249MeloricArt Collections (BOI22_art)C++17
Compilation error
0 ms0 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:14:18: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+18' to '2147483647' [-Woverflow]
   14 | const int inf  = 1e18;
      |                  ^~~~
art.cpp:16:8: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   16 | void p(auto A){
      |        ^~~~
art.cpp: In function 'int main()':
art.cpp:55:9: error: 't' was not declared in this scope
   55 |  cin >> t;
      |         ^
art.cpp:56:18: error: too few arguments to function 'void solve(int)'
   56 |  while(t--)solve();
      |                  ^
art.cpp:31:6: note: declared here
   31 | void solve(int N){
      |      ^~~~~
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) {
      |        ~~~~~~~~~^~~~