Submission #1109760

#TimeUsernameProblemLanguageResultExecution timeMemory
1109760n3rm1nArt Collections (BOI22_art)C++17
50 / 100
716 ms1648 KiB
#include <bits/stdc++.h> #include "art.h" using namespace std; int n; vector < int > init; int inits; int try_it(int f, int s) { int turn = 1, change = 2; if(f > s) { swap(turn, change); } vector < int > sf = init; swap(sf[f-1], sf[s-1]); int feedback1 = publish(sf); if(inits > feedback1) { turn = change; } return turn; } vector < int > combine(vector < int > f, vector < int > s) { vector < int > res; int i = 0; int j = 0; while(i < f.size() && j < s.size()) { int el1 = f[i]; int el2 = s[j]; int order = try_it(el1, el2); if(order == 1) { res.push_back(el1); i ++; } else { res.push_back(el2); j ++; } } while(i < f.size()) { res.push_back(f[i]); i ++; } while(j < s.size()) { res.push_back(s[j]); j ++; } return res; } vector < int > merge_sort(int l, int r) { if(l == r) { vector < int > v; v.push_back(l); return v; } int mid = (l + r)/2; vector < int > fh, sh; fh = merge_sort(l, mid); sh = merge_sort(mid+1, r); return combine(fh, sh); } void solve(int N) { n = N; for (int i = 1; i <= n; ++ i) init.push_back(i); inits = publish(init); vector < int > v = merge_sort(1, n); answer(v); return; }

Compilation message (stderr)

art.cpp: In function 'std::vector<int> combine(std::vector<int>, std::vector<int>)':
art.cpp:31:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     while(i < f.size() && j < s.size())
      |           ~~^~~~~~~~~~
art.cpp:31:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     while(i < f.size() && j < s.size())
      |                           ~~^~~~~~~~~~
art.cpp:47:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |     while(i < f.size())
      |           ~~^~~~~~~~~~
art.cpp:52:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |     while(j < s.size())
      |           ~~^~~~~~~~~~
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
#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...