Submission #426374

#TimeUsernameProblemLanguageResultExecution timeMemory
426374dualityThe Collection Game (BOI21_swaps)C++14
100 / 100
7 ms456 KiB
#include <bits/stdc++.h> using namespace std; #define mp make_pair #define pb push_back typedef long long int LLI; typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pii> vpii; #include "swaps.h" void solve(int N,int V) { int i,j,k,l; vi order; for (i = 1; i <= N; i++) order.pb(i); for (i = 1; i <= N; i *= 2) { for (j = i; j >= 1; j /= 2) { vpii v; for (k = j % i; k < N-j; k += 2*j) { for (l = 0; l < j; l++) { if (j+k+l >= N) break; if ((k+l)/(2*i) == (j+k+l)/(2*i)) v.pb(mp(k+l,j+k+l)); } } for (k = 0; k < v.size(); k++) schedule(order[v[k].first],order[v[k].second]); vi r = visit(); for (k = 0; k < v.size(); k++) { if (!r[k]) swap(order[v[k].first],order[v[k].second]); } } } answer(order); }

Compilation message (stderr)

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:24:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |             for (k = 0; k < v.size(); k++) schedule(order[v[k].first],order[v[k].second]);
      |                         ~~^~~~~~~~~~
swaps.cpp:26:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |             for (k = 0; k < v.size(); k++) {
      |                         ~~^~~~~~~~~~
#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...