Submission #987267

#TimeUsernameProblemLanguageResultExecution timeMemory
987267MateiKing80The Collection Game (BOI21_swaps)C++14
35 / 100
1028 ms6716 KiB
#include "swaps.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define fr first #define sc second #define pii pair<int, int> void solve(int n, int v) { set<pii> inf; for(int i = 1; i <= n; i ++) for(int j = i + 1; j <= n; j ++) inf.insert({i,j}); vector<int> ans(n); for(int i = 0; i < n; i ++) ans[i] = i + 1; for(int i = 0; i < v; i ++) { set<int> vis; set<pii> er; vector<pii> ins; for(auto it : inf) { int x = it.fr, y = it.sc; if(!vis.count(x) && !vis.count(y)) { schedule(ans[x-1], ans[y-1]); vis.insert(x); vis.insert(y); ins.pb({x,y}); er.insert(it); } } for(auto it : er) inf.erase(it); vector<int> get = visit(); for(int j = 0; j < get.size(); j ++) { int x = ins[j].fr, y = ins[j].sc; bool val = get[j]; if(!val) swap(ans[x-1], ans[y-1]); } } answer(ans); }

Compilation message (stderr)

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