Submission #1022984

#TimeUsernameProblemLanguageResultExecution timeMemory
1022984gygThe Collection Game (BOI21_swaps)C++17
27 / 100
38 ms1408 KiB
#include "swaps.h" #include <bits/stdc++.h> using namespace std; using pii = pair<int, int>; const int MAX_N = 5e2 + 5; int n; array<int, MAX_N> n_beats; void solve(int _n, int _v) { n = _n; int x = 1, y = 1; while (!(x == n - 1 && y == n)) { if (y != n) y++; else x++; vector<pii> queries; int i = 0; while (true) { int new_x = x + i, new_y = y - i; if (new_y <= new_x) break; // Checks for repeats needed queries.push_back({new_x, new_y}); schedule(new_x, new_y); i++; } vector<int> resp = visit(); for (int i = 0; i < queries.size(); i++) { if (resp[i] == 1) n_beats[queries[i].first]++; else n_beats[queries[i].second]++; } } // for (int i = 1; i <= n; i++) { // cerr << i << ": " << n_beats[i] << endl; // } vector<int> ans(n); for (int i = 1; i <= n; i++) ans[n - n_beats[i] - 1] = i; answer(ans); }

Compilation message (stderr)

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:30: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]
   30 |         for (int i = 0; i < queries.size(); i++) {
      |                         ~~^~~~~~~~~~~~~~~~
#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...