Submission #417840

#TimeUsernameProblemLanguageResultExecution timeMemory
417840Kevin_Zhang_TWThe Collection Game (BOI21_swaps)C++17
35 / 100
129 ms484 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; #define pb emplace_back #define AI(i) begin(i), end(i) template<class T> bool chmin(T &a, T b) { return b < a && (a = b, true); } template<class T> bool chmax(T &a, T b) { return a < b && (a = b, true); } #ifdef KEV #define DE(args...) kout("[ " + string(#args) + " ] = ", args) void kout() { cerr << endl; } template<class T, class ...U> void kout(T a, U ...b) { cerr << a << ' ', kout(b...); } template<class T> void debug(T l, T r) { while (l != r) cerr << *l << " \n"[next(l)==r], ++l; } #else #define DE(...) 0 #define debug(...) 0 #endif #include "swaps.h" const int MAX_N = 300010; void solve(int N, int V) { vector<int> id(N); iota(AI(id), 1); for (int i = 0;i < N+N;++i) { vector<pair<int,int>> comp; for (int j = i&1;j+1 < N;j += 2) { schedule(id[j], id[j+1]); comp.pb(j, j+1); } vector<int> ret = visit(); for (int j = 0;j < ret.size();++j) { if (ret[j] == 0) { auto [x, y] = comp[j]; swap(id[x], id[y]); } } } answer(id); }

Compilation message (stderr)

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:32:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |   for (int j = 0;j < ret.size();++j) {
      |                  ~~^~~~~~~~~~~~
#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...
#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...