Submission #586942

#TimeUsernameProblemLanguageResultExecution timeMemory
5869428e7Super Dango Maker (JOI22_dango3)C++17
100 / 100
430 ms552 KiB
//Challenge: Accepted #include "dango3.h" #include <bits/stdc++.h> using namespace std; #ifdef zisk void debug(){cout << endl;} template<class T, class ... U> void debug(T a, U ... b){cout << a << " ", debug(b...);} template<class T> void pary(T l, T r) { while (l != r) cout << *l << " ", l++; cout << endl; } #else #define debug(...) 0 #define pary(...) 0 #endif #define ll long long #define maxn 100005 #define pii pair<int, int> #define ff first #define ss second #define io ios_base::sync_with_stdio(0);cin.tie(0); namespace { int query(vector<int> &x) { pary(x.begin(), x.end()); return Query(x); } } // namespace void Solve(int N, int M) { srand(time(NULL)); vector<bool> vis(N*M, 0); for (int i = 0; i < M; i++) { vector<int> v; for (int j = 0;j < N*M;j++) { if (!vis[j]) { v.push_back(j+1); } } random_shuffle(v.begin(), v.end()); //debug("poss"); //pary(v.begin(), v.end()); vector<int> a; if (i == M - 1) { a = v; } else { int low = 0, up = v.size(); while (low < up - 1) { int mid = (low + up) / 2; vector<int> q(v.begin(), v.begin() + mid); if (query(q) >= 1) { up = mid; } else { low = mid; } } a.push_back(v[low]); for (int j = low-1;j >= 0;j--) { vector<int> q(v.begin(), v.begin() + j); q.insert(q.end(), a.begin(), a.end()); if (query(q) == 0) { a.push_back(v[j]); } } } debug("Answer"); pary(a.begin(), a.end()); Answer(a); for (int j:a) vis[j-1] = 1; } }

Compilation message (stderr)

dango3.cpp: In function 'int {anonymous}::query(std::vector<int>&)':
dango3.cpp:14:19: warning: statement has no effect [-Wunused-value]
   14 | #define pary(...) 0
      |                   ^
dango3.cpp:24:3: note: in expansion of macro 'pary'
   24 |   pary(x.begin(), x.end());
      |   ^~~~
dango3.cpp: In function 'void Solve(int, int)':
dango3.cpp:13:20: warning: statement has no effect [-Wunused-value]
   13 | #define debug(...) 0
      |                    ^
dango3.cpp:66:3: note: in expansion of macro 'debug'
   66 |   debug("Answer");
      |   ^~~~~
dango3.cpp:14:19: warning: statement has no effect [-Wunused-value]
   14 | #define pary(...) 0
      |                   ^
dango3.cpp:67:3: note: in expansion of macro 'pary'
   67 |   pary(a.begin(), a.end());
      |   ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...