Submission #1075435

#TimeUsernameProblemLanguageResultExecution timeMemory
1075435hcngArt Collections (BOI22_art)C++17
100 / 100
1171 ms1796 KiB
// Problem: #3774. 「BalticOI 2022 Day1」Art Collections // Contest: LibreOJ // URL: https://loj.ac/p/3774 // Memory Limit: 512 MB // Time Limit: 3000 ms // // Powered by CP Editor (https://cpeditor.org) #include <bits/stdc++.h> #include "art.h" using namespace std; int a[4010], b[4010]; void solve(int n) { a[1] = 1; vector<int> yeet; for (int i = 1; i <= n; i++) { yeet.push_back(i); } int s = publish(yeet); for (int i = 2; i <= n; i++) { vector<int> R; R.push_back(i); for (int j = 1; j <= i - 1; j++) { R.push_back(a[j]); } for (int j = i + 1; j <= n; j++) { R.push_back(j); } int res = publish(R); int r = (i - 1 - (s - res)) / 2; s -= i - 1 - r; // r + x = i - 1; // x - r = res; // 2r = i - 1 - res; // s -= x for (int j = 1; j <= r; j++) { b[j] = a[j]; } b[r + 1] = i; for (int j = r + 1; j <= i - 1; j++) { b[j + 1] = a[j]; } for (int j = 1; j <= i; j++) { a[j] = b[j]; } } vector<int> ans; for (int i = 1; i <= n; i++) { ans.push_back(a[i]); } answer(ans); }

Compilation message (stderr)

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...